protected void Init()
        {
            switch (Id)
            {
            case ConstructId.Yard:
                Owned = new ConstructId[]
                {
                    ConstructId.Refinery,
                };
                break;

            case ConstructId.Refinery:
                Owned = new ConstructId[]
                {
                    ConstructId.Barrack,
                };
                break;

            case ConstructId.Barrack:
                Owned = new ConstructId[]
                {
                    ConstructId.Defender,
                    ConstructId.Radar,
                };
                break;

            default:
                Owned = new ConstructId[0];
                break;
            }
        }
        private NodeState BuyConstruct(ConstructId type)
        {
            if (!constructCountQuery.ContainsKey(type))
            {
                constructCountQuery.Add(new QueryItem <ConstructId, float>(type, 0.0f), true);
                int price = 0;
                switch (type)
                {
                case ConstructId.Barrack:
                    price = ConstructPrice.Barrack;
                    break;

                case ConstructId.Defender:
                    price = ConstructPrice.Defender;
                    break;

                case ConstructId.Refinery:
                    price = ConstructPrice.Refinery;
                    break;

                case ConstructId.Yard:
                    price = ConstructPrice.Yard;
                    break;
                }
                npc.TakeGold(-price);
            }
            return(NodeState.Success);
        }
 public void ResetTaget()
 {
     OnselectTaget        = false;
     OnholdTaget          = false;
     BuildSize            = new Vector2();
     BuildModel           = null;
     BuildModelContructID = ConstructId.None;
 }
 private NodeState CheckUnclockedConstruct(ConstructId type)
 {
     if (npc.IsCanBuild(type))
     {
         return(NodeState.Success);
     }
     return(NodeState.Failure);
 }
 private NodeState SetConstructPosition(ConstructId type, Vector3 pos, Transform construct)
 {
     if (constructCountQuery.Remove(type))
     {
         construct.position = pos;
         return(NodeState.Success);
     }
     return(NodeState.Failure);
 }
        private NodeState CheckConstructCountdown(ConstructId type)
        {
            float time;

            if (constructCountQuery.TryGetValue(type, out time))
            {
                if (time >= ConstructBuyDelay[type])
                {
                    return(NodeState.Success);
                }
            }
            return(NodeState.Failure);
        }
Ejemplo n.º 7
0
 public bool IsCanBuild(ConstructId type)
 {
     return(status.IsCanBuild(type));
 }
 public bool IsCanBuild(ConstructId type)
 {
     return(ConstructsCantBuild.Contains(type));
 }