Inheritance: Obstacle
コード例 #1
0
    public static PowerShard JSONToPowerShard(JSONObject powerShard, Hexagon position)
    {
        int coolDown=(int)powerShard.GetField("coolDown").n;
        List<JSONObject> ids = powerShard.GetField("effectIds").list;
        List<int> effectIds = new List<int>();

        foreach(JSONObject jo in ids)
        {
            effectIds.Add((int)jo.n);
        }
        PowerShard ps = new PowerShard(position, coolDown, effectIds);
        ps.GameObject = new GameObject();
        CapsuleCollider collider = ps.GameObject.AddComponent<CapsuleCollider>();
        collider.height = 5;
        collider.radius = 0.5f;
        ps.GameObject.name = powerShard.GetField("gameObject").str;
        return ps;
    }
コード例 #2
0
 public void RemovePowerShard(PowerShard shard)
 {
     PowerShards.Remove(shard);
 }
コード例 #3
0
 public void AddPowerShard(PowerShard shard)
 {
     PowerShards.Add(shard);
 }
コード例 #4
0
 public void BuildShard()
 {
     Hexagon hex = PlayBoardManager.GetInstance().Board.GetHexagone(x, y);
     if (hex != null && !(hex._posX < 0))
     {
         if (hex.GameObject != null && hex._entity == null)
         {
             GameObject go = Instantiate<GameObject>(shard);
             go.transform.position = new Vector3(0.866f * x - 0.433f * y, z, 0.75f * y);
             go.transform.parent = hex.GameObject.transform;
             go.name = shard.name;
             go.layer = LayerMask.NameToLayer("Obstacle");
             PowerShard powerShard = new PowerShard(hex, coolDownShard, shardsEffects);
             powerShard.GameObject = go;
             hex._entity = powerShard;
             PlayBoardManager.GetInstance().Board.AddPowerShard(powerShard);
         }
     }
    
 }