备份CatanBuilding瘦身独立工程
This commit is contained in:
132
Assets/Scripts/EventPinball/PinballPelletTrackInfo.cs
Normal file
132
Assets/Scripts/EventPinball/PinballPelletTrackInfo.cs
Normal file
@@ -0,0 +1,132 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
|
||||
namespace game
|
||||
{
|
||||
public class PinballPelletTrackInfo
|
||||
{
|
||||
public int ID { get; set; }
|
||||
public string Name { get; set; }
|
||||
public float Force { get; set; }
|
||||
public float Gravity { get; set; }
|
||||
public int Score { get; set; }
|
||||
public int Multiple { get; set; }
|
||||
public List<PinballPelletTrackNode> TrackNodeList = new List<PinballPelletTrackNode>();
|
||||
public List<string> RoutePointList = new List<string>();
|
||||
public override string ToString()
|
||||
{
|
||||
StringBuilder str = new StringBuilder("");
|
||||
str.Append(ID + ",");
|
||||
str.Append(Name + ",");
|
||||
str.Append(Force + ",");
|
||||
|
||||
int count = RoutePointList.Count;
|
||||
str.Append(count + ",");
|
||||
str.Append(Multiple + ",");
|
||||
str.Append(Score + ",");
|
||||
|
||||
//if (count > 0)
|
||||
//{
|
||||
// str.Append(RoutePointList[0]);
|
||||
//}
|
||||
//for (int i = 1; i < count; ++i)
|
||||
//{
|
||||
// str.Append("_" + RoutePointList[i]);
|
||||
//}
|
||||
//str.Append(",");
|
||||
|
||||
////str.Append("total_" + count);
|
||||
|
||||
//if (count > 0)
|
||||
//{
|
||||
// Dictionary<string, int> temp = new Dictionary<string, int>();
|
||||
// foreach (var item in RoutePointList)
|
||||
// {
|
||||
// if (temp.ContainsKey(item))
|
||||
// {
|
||||
// int value = temp[item];
|
||||
// value++;
|
||||
// temp[item] = value;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// temp.Add(item, 1);
|
||||
// }
|
||||
// }
|
||||
// foreach (var item in temp)
|
||||
// {
|
||||
// str.Append("-" + item.Key + "_" + item.Value);
|
||||
// }
|
||||
//}
|
||||
|
||||
//str.Append(",");
|
||||
|
||||
//foreach (var item in TrackNodeList)
|
||||
//{
|
||||
// str.Append(item.ToString());
|
||||
//}
|
||||
return str.ToString();
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
foreach (var item in TrackNodeList)
|
||||
{
|
||||
item.Clear();
|
||||
}
|
||||
TrackNodeList.Clear();
|
||||
RoutePointList.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
public class PinballPelletTrackNode
|
||||
{
|
||||
public EventPinballTrackType TrackType { get; set; }
|
||||
public string ContactName { get; set; }
|
||||
public string MaterialName { get; set; }
|
||||
public List<TrackNodeContactPoint2D> ContactPoint2DList = new List<TrackNodeContactPoint2D>();
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
int count = ContactPoint2DList.Count;
|
||||
|
||||
StringBuilder str = new StringBuilder("");
|
||||
str.Append(TrackType + "-");
|
||||
if (count > 0)
|
||||
{
|
||||
str.Append(ContactName + "_" + MaterialName + "-");
|
||||
}
|
||||
else
|
||||
{
|
||||
str.Append(ContactName + "_" + MaterialName + "|");
|
||||
}
|
||||
|
||||
foreach (var item in ContactPoint2DList)
|
||||
{
|
||||
str.Append(item.ToString());
|
||||
}
|
||||
return str.ToString();
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
ContactPoint2DList.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
public class TrackNodeContactPoint2D
|
||||
{
|
||||
public Vector2 Velocity { get; set; }
|
||||
public Vector2 Position { get; set; }
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
StringBuilder str = new StringBuilder("");
|
||||
str.Append("V(" + Velocity.x + "_" + Velocity.y + ")-");
|
||||
str.Append("P(" + Position.x + "_" + Position.y + ")|");
|
||||
return str.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user