Пример #1
0
    public override void SendMouse1Order(RTSGameObject target, bool directOrder, bool postpone)
    {
        if (!postpone)
        {
            if (target.GetComponent <Unit>())
            {
                if (target.faction == Faction.Neutral)
                {
                    Debug.Log("Can't attack this target");
                }

                else if (target.faction != this.faction)
                {
                    SendMessage("StopAction"); // Interrupt any other actions
                    AttackScript.Attack(target);
                }
            }
            else if (target.GetComponent <Collectable>()) // Goldmine, wood
            {
                MoveScript.Move(target.transform.position);
            }

            else if (target.GetComponent <CollectableObject>()) // Collectable object
            {
                // Take the Object
            }
        }
        else
        {
            Orders.AddLast(new Order(OrderName.Mouse1, Vector3.zero, target));
        }
    }
Пример #2
0
    public void SendBuildOrder(GameObject building, GameObject buildingGhost, Vector3 position, Quaternion quaternion, bool directOrder, bool postpone)
    {
        if (!postpone)
        {
            if (directOrder)
            {
                foreach (Order order in Orders)
                {
                    if (order.BuildingGhost)
                    {
                        order.BuildingGhost.GetComponent <BuildingGhost>().NbWorkersAssigned--;
                    }
                }
                Orders.Clear();
            }

            SendMessage("StopAction");
            UnitBuildScript.Build(building, buildingGhost, position);
        }
        else
        {
            buildingGhost.GetComponent <BuildingGhost>().NbWorkersAssigned++;
            Orders.AddLast(new Order(OrderName.Build0, position, building.GetComponent <RTSGameObject>(), buildingGhost));
        }
    }
Пример #3
0
    public void SendAttackOrder(RTSGameObject target, bool directOrder, bool postpone)
    {
        if (!postpone)
        {
            if (directOrder)
            {
                Orders.Clear();
            }
            if (target.GetComponent <Unit>())
            {
                if (target.faction == Faction.Neutral)
                {
                    Debug.Log("Can't attack this target");
                }

                else if (target.faction != this.faction)
                {
                    SendMessage("StopAction"); // Interrupt any other actions
                    AttackScript.Attack(target);
                }
            }
            else if (target.GetComponent <Collectable>())
            {
            }
            else if (target.GetComponent <CollectableObject>())
            {
            }
        }
        else
        {
            Orders.AddLast(new Order(OrderName.Attack, Vector3.zero, target));
        }
    }
Пример #4
0
    public override void SendMouse1Order(RTSGameObject target, bool directOrder, bool postpone)
    {
        if (!postpone)
        {
            if (directOrder)
            {
                foreach (Order order in Orders)
                {
                    if (order.BuildingGhost)
                    {
                        order.BuildingGhost.GetComponent <BuildingGhost>().NbWorkersAssigned--;
                    }
                }
                Orders.Clear();
            }

            if (target.GetComponent <Unit>())
            {
                SendMessage("StopAction");
                MoveScript.Move(target.transform.position);
            }
            else
            {
                Debug.Log("Order can't be interpreted");
            }
        }
        else
        {
            Orders.AddLast(new Order(OrderName.Mouse1, Vector3.zero, target));
        }
    }
Пример #5
0
    public override void SendStopOrder(bool directOrder, bool postpone)
    {
        if (!postpone)
        {
            if (directOrder)
            {
                Orders.Clear();
            }

            SendMessage("StopAction");
        }
        else
        {
            Orders.AddLast(new Order(OrderName.Stop, Vector3.zero, null));
        }
    }
Пример #6
0
    public override void SendMouse1Order(Vector3 position, bool directOrder, bool postpone)
    {
        if (!postpone)
        {
            if (directOrder)
            {
                Orders.Clear();
            }

            SendMessage("StopAction"); // Interrupt any other actions
            MoveScript.Move(position);
        }
        else
        {
            Orders.AddLast(new Order(OrderName.Mouse1, position, null));
        }
    }
Пример #7
0
    public void SendCollectOrder(Collectable target, bool directOrder, bool postpone)
    {
        if (!postpone)
        {
            if (directOrder)
            {
                Orders.Clear();
            }

            SendMessage("StopAction"); // Interrupt any other actions
            CollectScript.Collect(target);
        }
        else
        {
            Orders.AddLast(new Order(OrderName.Collect, Vector3.zero, target));
        }
    }
Пример #8
0
 public void SendAttackOrder(Vector3 position, bool directOrder, bool postpone)
 {
     if (!postpone)
     {
         if (directOrder)
         {
             Orders.Clear();
         }
         // To be implemented
         SendMessage("StopAction");
         AttackScript.MoveAttack(position);
     }
     else
     {
         Orders.AddLast(new Order(OrderName.Attack, position, null));
     }
 }
Пример #9
0
    public void SendMoveOrder(Vector3 position, bool directOrder, bool postpone)
    {
        if (!postpone)
        {
            if (directOrder)
            {
                Orders.Clear();
            }

            SendMessage("StopAction");
            MoveScript.Move(position);
        }
        else
        {
            Orders.AddLast(new Order(OrderName.Move, position, null));
        }
    }
Пример #10
0
    public void SendPatrolOrder(Vector3 position, bool directOrder, bool postpone)
    {
        if (!postpone)
        {
            if (directOrder)
            {
                Orders.Clear();
            }

            SendMessage("StopAction");
            MoveScript.Patrol(gameObject.transform.position, position);
        }
        else
        {
            Orders.AddLast(new Order(OrderName.Patrol, position, null));
        }
    }
Пример #11
0
 public override void SendMouse1Order(RTSGameObject target, bool directOrder, bool postpone)
 {
     print("got tf heer");
     if (!postpone)
     {
         if (directOrder)
         {
             Orders.Clear();
         }
         if (target.GetComponent <Collectable>()) // Goldmine, wood
         {
             print("got here");
             SendMessage("StopAction"); // Interrupt any other actions
             CollectScript.Collect(target.GetComponent <Collectable>());
         }
     }
     else
     {
         Orders.AddLast(new Order(OrderName.Mouse1, Vector3.zero, target));
     }
 }
Пример #12
0
 public override void SendMouse1Order(Vector3 position, bool directOrder, bool postpone)
 {
     if (!postpone)
     {
         if (directOrder)
         {
             foreach (Order order in Orders)
             {
                 if (order.BuildingGhost)
                 {
                     order.BuildingGhost.GetComponent <BuildingGhost>().NbWorkersAssigned--;
                 }
             }
             Orders.Clear();
         }
         SendMessage("StopAction"); // Interrupt any other actions
         MoveScript.Move(position);
     }
     else
     {
         Orders.AddLast(new Order(OrderName.Mouse1, position, null));
     }
 }