Exemplo n.º 1
0
 protected virtual void CommandUnits(List<Unit> units, UnitCommand command, params object[] args)
 {
     for (int i = 0; i < units.Count; i++)
     {
         command(units[i], args);
     }
 }
Exemplo n.º 2
0
    public void ExecuteUnitCommand()
    {
        UnitCommand unitCommand = unitCommandsToExecute.Dequeue();

        unitCommand.Execute();
        unitCommandsExecuted.Enqueue(unitCommand);
    }
    public virtual void AttackMove()
    {
        setRunning(true);
        unitScript.unitTargetScript.UpdateTarget();

        if(unitScript.unitTargetScript.attackTarget) {
            previousCommand = unitScript.currentCommand;
            unitScript.currentCommand = UnitCommand.Attack;
            return;
        }

        if(unitScript.movementScript.followTarget == null) {
            if(unitScript.movementScript.hasReachedDestination(unitScript.spreadDistance / 2.0f)) {
                unitScript.unitTargetScript.resetTarget();
                unitScript.currentIdleTime = 0.0f;
                unitScript.movementScript.UpdateDestination(unitScript.newIdlePosition(unitScript.unitGroupScript.transform.position, unitScript.spreadDistance));
                unitScript.currentCommand = UnitCommand.Idle;
            }
        } else {
            if(unitScript.movementScript.isWithinGroupRange()) {
                unitScript.unitTargetScript.resetTarget();
                unitScript.currentIdleTime = 0.0f;
                unitScript.movementScript.UpdateDestination(unitScript.newIdlePosition(unitScript.unitGroupScript.transform.position, unitScript.spreadDistance));
                unitScript.currentCommand = UnitCommand.Idle;
            }
        }
    }
Exemplo n.º 4
0
    public static IEnumerator Defend(Unit origin, float duration)
    {
        bool isAlly       = origin.GetType() == typeof(Ally);
        Ally originAsAlly = null;

        UnitCommand[] commandCache = null;
        if (isAlly)
        {
            originAsAlly = origin as Ally;
            commandCache = originAsAlly.commands;
            UnitCommand stopCommand = new UnitCommand(UnitActions.Stop, 0);
            originAsAlly.commands = new UnitCommand[] { stopCommand };
            origin.state          = UnitStates.CannotAction;
            yield return(null);
        }
        origin.state      = UnitStates.CanAction;
        origin.isGuarding = true;
        for (float timer = 0; true; timer += Time.deltaTime)
        {
            if (origin.state == UnitStates.InterruptAction || (!isAlly && timer > duration))
            {
                break;
            }
            yield return(null);
        }
        origin.isGuarding = false;
        if (isAlly)
        {
            originAsAlly.commands = commandCache;
            MenuManager.Instance.FillMenu(originAsAlly);
        }
        origin.state = UnitStates.CanAction;
    }
Exemplo n.º 5
0
    public void AttackTarget()
    {
        AttackCommand command   = (AttackCommand)currentCommand;
        Vector3       targetPos = new Vector3(command.target.transform.position.x, 0f, command.target.transform.position.y);
        float         dist      = Vector3.Distance(targetPos, transform.position);

        Debug.Log(dist);
        if (dist > attackRange)
        {
            agent.destination = targetPos;
        }
        else
        {
            if (isMelee)
            {
                //punch
            }
            else
            {
                GameObject go;
                go = GameObject.Instantiate(Resources.Load <GameObject>("Prefabs/Projectile"));
                go.transform.position = transform.position;
                Projectile projectile = go.GetComponent <Projectile>();
                projectile.target = command.target;
                projectile.speed  = projectileSpeed;
                currentCommand    = null;
                agent.destination = transform.position;
            }
        }
    }
Exemplo n.º 6
0
 protected virtual void CommandUnits(List <Unit> units, UnitCommand command, params object[] args)
 {
     for (int i = 0; i < units.Count; i++)
     {
         command(units[i], args);
     }
 }
Exemplo n.º 7
0
 static void Postfix(UnitCommand command, ref float?__state)
 {
     if (__state.HasValue)
     {
         command.SetTimeSinceStart(__state.Value);
     }
 }
Exemplo n.º 8
0
 public AboutViewModel()
 {
     OpenEmail = new DelegateCommand <string>(email => {
         var emailTask = new EmailComposeTask()
         {
             Subject = "MusicPimp Feedback",
             Body    = "Great app! I'm using " + NameAndVersion + " for Windows Phone.",
             To      = email
         };
         emailTask.Show();
     });
     OpenWebsite = new DelegateCommand <string>(url => {
         var browserTask = new WebBrowserTask();
         var uri         = new Uri(url, UriKind.RelativeOrAbsolute);
         browserTask.Uri = uri;
         browserTask.Show();
     });
     OpenMarketPlace = new UnitCommand(() => {
         var reviewTask = new MarketplaceReviewTask();
         reviewTask.Show();
         //var marketplaceDetailTask = new MarketplaceDetailTask();
         //marketplaceDetailTask.ContentIdentifier = "d31b505b-ac9f-4d93-8812-6b649734a5a6";
         //marketplaceDetailTask.ContentType = MarketplaceContentType.Applications;
         //marketplaceDetailTask.Show();
     });
 }
Exemplo n.º 9
0
    virtual public void setTarget(GameObject target, int priority)
    {
        if (unitCombatTarget != null)
        {
            unitCombatTarget.SendMessage("removeUnitTargetingMe", this, SendMessageOptions.DontRequireReceiver);
        }
        CancelInvoke("attackTarget");

        if (target == null)
        {
            unitTargetPriority = priority;
            unitCombatTarget   = null;
        }
        else if (priority > unitTargetPriority)
        {
            unitTargetPriority = priority;
            unitCombatTarget   = target;
            unitCommand        = UnitCommand.Attack;

            unitCombatTarget.SendMessage("addUnitTargetingMe", this, SendMessageOptions.DontRequireReceiver);

            if (unitCombatTarget.GetComponent <NavMeshAgent>())
            {
                enemyUnitRadius = unitCombatTarget.GetComponent <NavMeshAgent>().radius;
            }
            else
            {
                enemyUnitRadius = 0.5f;
            }
        }
    }
Exemplo n.º 10
0
    public virtual void AttackMove()
    {
        setRunning(true);
        unitScript.unitTargetScript.UpdateTarget();

        if (unitScript.unitTargetScript.attackTarget)
        {
            previousCommand           = unitScript.currentCommand;
            unitScript.currentCommand = UnitCommand.Attack;
            return;
        }

        if (unitScript.movementScript.followTarget == null)
        {
            if (unitScript.movementScript.hasReachedDestination(unitScript.spreadDistance / 2.0f))
            {
                unitScript.unitTargetScript.resetTarget();
                unitScript.currentIdleTime = 0.0f;
                unitScript.movementScript.UpdateDestination(unitScript.newIdlePosition(unitScript.unitGroupScript.transform.position, unitScript.spreadDistance));
                unitScript.currentCommand = UnitCommand.Idle;
            }
        }
        else
        {
            if (unitScript.movementScript.isWithinGroupRange())
            {
                unitScript.unitTargetScript.resetTarget();
                unitScript.currentIdleTime = 0.0f;
                unitScript.movementScript.UpdateDestination(unitScript.newIdlePosition(unitScript.unitGroupScript.transform.position, unitScript.spreadDistance));
                unitScript.currentCommand = UnitCommand.Idle;
            }
        }
    }
Exemplo n.º 11
0
 public EndpointEditorViewModel()
 {
     Tester      = new EndpointTester();
     Add         = new AsyncUnitCommand(AddEndpoint);
     Cancel      = new UnitCommand(Close);
     DisplayHelp = new UnitCommand(() => Send(MusicItemsBase.AppHelpHeader, MusicItemsBase.AppHelpMessage));
 }
            static bool Prefix(UnitCombatState __instance, UnitCommand.CommandType commandType, ref bool __result)
            {
                if (IsInCombat() && __instance.Unit.IsInCombat)
                {
                    switch (commandType)
                    {
                    case UnitCommand.CommandType.Free:
                        __result = false;
                        break;

                    case UnitCommand.CommandType.Move:
                        __result = !__instance.Unit.HasMoveAction();
                        break;

                    case UnitCommand.CommandType.Standard:
                        UnitCommand moveCommand = __instance.Unit.Commands.GetCommand(UnitCommand.CommandType.Move);
                        __result = (moveCommand != null && moveCommand.IsRunning) || !__instance.Unit.HasStandardAction();
                        break;

                    case UnitCommand.CommandType.Swift:
                        __result = __instance.Cooldown.SwiftAction > 0f;
                        break;

                    default:
                        throw new ArgumentOutOfRangeException();
                    }
                    return(false);
                }
                return(true);
            }
Exemplo n.º 13
0
 static bool Prefix(UnitCommand command)
 {
     if (IsInCombat() && command.Executor.IsInCombat)
     {
         if (command is UnitAttack unitAttack)
         {
             if (command.Executor.PreparedSpellCombat())
             {
                 UnitPartMagus unitPartMagus = command.Executor.Get <UnitPartMagus>();
                 unitAttack.IgnoreCooldown(unitPartMagus.AttackIgnoringCooldownBeforeTime);
                 unitPartMagus.Owner.AddBuff(
                     BlueprintRoot.Instance.SystemMechanics.MagusSpellCombatBuff,
                     unitPartMagus.Owner.Unit, 1.Rounds().Seconds, null);
             }
             else if (command.Executor.PreparedSpellStrike())
             {
                 UnitPartMagus unitPartMagus = command.Executor.Get <UnitPartMagus>();
                 unitAttack.IgnoreCooldown(unitPartMagus.AttackIgnoringCooldownBeforeTime);
                 unitAttack.IsSingleAttack = true;
             }
         }
         return(false);
     }
     return(true);
 }
Exemplo n.º 14
0
 static void Prefix(UnitCommand command)
 {
     if (IsInCombat() && command.Executor.IsInCombat && command.IsSpellCombatAttack())
     {
         command.Executor.CombatState.Cooldown.MoveAction += TIME_MOVE_ACTION;
     }
 }
Exemplo n.º 15
0
            static void Postfix(UnitCommand cmd, ref UnitCommands.CustomHandlerData?customHandler)
            {
                if (Mod.Enabled && FixKineticistWontStopPriorCommand &&
                    customHandler.HasValue && (customHandler.Value.ExecuteBefore ?? cmd) != cmd)
                {
                    UnitCommands commands = cmd.Executor.Commands;

                    // remove conflicting command
                    UnitCommand prior = commands.Raw[(int)cmd.Type] ?? commands.GetPaired(cmd);
                    if (Game.Instance.IsPaused && commands.PreviousCommand == null && prior != null && prior.IsRunning)
                    {
                        commands.PreviousCommand = prior;
                        commands.PreviousCommand.SuppressAnimation();
                        commands.Raw[(int)commands.PreviousCommand.Type] = null;
                    }
                    else
                    {
                        commands.InterruptAndRemoveCommand(cmd.Type);
                    }

                    // update target
                    if (cmd.Type == UnitCommand.CommandType.Standard || commands.Standard == null)
                    {
                        commands.UpdateCombatTarget(cmd);
                    }
                }
            }
Exemplo n.º 16
0
 public uint PlayerCommand(UnitCommand cmd)
 {
     cmd._orderSequence = _orderSequence;
     ++_orderSequence;
     _brain.AddCommand(cmd);
     return(cmd._orderSequence);
 }
 static void Prefix(UnitCommand __instance)
 {
     if (IsInCombat() && __instance.Executor.IsInCombat && !__instance.IsActed)
     {
         __instance.SetIsActed(true);
     }
 }
        public static void UpdateCooldowns(this UnitEntityData unit, UnitCommand command)
        {
            if (!command.IsIgnoreCooldown)
            {
                UnitCombatState.Cooldowns cooldown = unit.CombatState.Cooldown;
                switch (command.Type)
                {
                case UnitCommand.CommandType.Free:
                    break;

                case UnitCommand.CommandType.Move:
                    cooldown.MoveAction += TIME_MOVE_ACTION;
                    break;

                case UnitCommand.CommandType.Standard:
                    cooldown.StandardAction += TIME_STANDARD_ACTION;
                    if (command.IsFullRoundAction())
                    {
                        cooldown.MoveAction += TIME_MOVE_ACTION;
                    }
                    break;

                case UnitCommand.CommandType.Swift:
                    cooldown.SwiftAction += TIME_SWIFT_ACTION;
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }
            }
        }
Exemplo n.º 19
0
    private void HandleOrders()
    {
        switch (this.commandState)
        {
        case UnitCommand.NO_ORDERS:
            if (Input.GetMouseButtonUp(1))
            {
                Move();
            }
            else if (Input.GetKeyDown(KeyCode.A) || Input.GetKeyDown(KeyCode.S) || Input.GetKeyDown(KeyCode.D))
            {
                this.commandState = UnitCommand.NO_ORDERS;
                this.actionState  = UnitState.WAITING_FOR_ORDERS;
            }
            break;

        case UnitCommand.MOVE_ORDER:
            if (Input.GetMouseButtonUp(1))
            {
                Move();
            }
            break;

        default:
            break;
        }
    }
Exemplo n.º 20
0
 private void WaitingOnOrders()
 {
     if (this.commandState.Equals(UnitCommand.NO_ORDERS) && this.actionState.Equals(UnitState.WAITING_FOR_ORDERS))
     {
         if (Input.GetKeyUp(KeyCode.A))
         {
             this.commandState = UnitCommand.ATTACK_ORDER;
             Debug.Log("ATTACK ORDER");
         }
         else if (Input.GetKeyUp(KeyCode.S))
         {
             this.commandState = UnitCommand.SPLIT_ORDER;
             Debug.Log("SPLIT ORDER");
         }
         else if (Input.GetKeyUp(KeyCode.D))
         {
             this.commandState = UnitCommand.MERGE_ORDER;
             Debug.Log("MERGE ORDER");
         }
         else if (Input.GetMouseButtonUp(1))
         {
             this.commandState = UnitCommand.MOVE_ORDER;
             Move();
             Debug.Log("MOVE ORDER");
         }
         else if (Input.GetMouseButtonUp(0))
         {
             this.commandState = UnitCommand.NO_ORDERS;
             this.actionState  = UnitState.IDLE;
             Debug.Log("CANCEL ORDER");
         }
     }
 }
Exemplo n.º 21
0
 static void Postfix(UnitEntityData __instance, ref UnitCommand __state)
 {
     if (__state != null)
     {
         __instance.Commands.Raw[(int)UnitCommand.CommandType.Standard] = __state;
     }
 }
Exemplo n.º 22
0
 static void Prefix(UnitEntityData __instance, ref UnitCommand __state)
 {
     if (IsEnabled())
     {
         __state = __instance.Commands.Standard;
         __instance.Commands.Raw[(int)UnitCommand.CommandType.Standard] = null;
     }
 }
Exemplo n.º 23
0
        /// <summary>
        /// Commands a unit
        /// </summary>
        /// <param name="cmd"></param>
        public void CommandUnit(UnitCommand cmd)
        {
            ConsoleManager.Instance.WriteLine($"Commanded {AllUnits.Find(u => u.InstanceID == cmd.UnitInstanceID).Name} - {cmd.CommandID}");
            Packet p = new Packet((int)PacketHeader.UnitCommand, cmd);

            SelectedCommand = UnitCommandID.UNITCMD_NULL;
            client.SendData(p);
        }
 public bool Equals(UnitCommand obj)
 {
     if (obj == null)
     {
         return(false);
     }
     return(obj.swigCPtr.Handle == this.swigCPtr.Handle);
 }
Exemplo n.º 25
0
        public static void NastavAktualniCasQueued(int addr)
        {
            Logger.Info("");

            var uc = new UnitCommand(() => _unitDictionary[addr].SetCas(DateTime.Now), "NastavAktualniCas", addr);

            _unitCommandsQueue.Enqueue(uc);
        }
Exemplo n.º 26
0
 public bool changeCommand(UnitCommand newCommand)
 {
     if(newCommand <= unitGroupCommand) {
         unitGroupCommand = newCommand;
         return true;
     }
     return false;
 }
Exemplo n.º 27
0
        public static bool IsOffensiveCommand(this UnitCommand command)
        {
            UnitEntityData executor;
            UnitEntityData target;

            return(command != null && !command.IsFinished && (command is UnitAttack || command is UnitUseAbility) &&
                   (target = command.TargetUnit) != null && target != (executor = command.Executor) && executor.CanAttack(target));
        }
Exemplo n.º 28
0
    // Start is called before the first frame update
    void Start()
    {
        _agent = GetComponent <NavMeshAgent>();

        _unitCommand = UnitCommand.instance;

        OnUnitSelected   += AddToSelectedList;
        OnUnitDeselected += RemoveFromSelectedList;
    }
Exemplo n.º 29
0
 public bool changeCommand(UnitCommand newCommand)
 {
     if (newCommand <= unitGroupCommand)
     {
         unitGroupCommand = newCommand;
         return(true);
     }
     return(false);
 }
Exemplo n.º 30
0
    public void SendUnitCommand(UnitCommand uc)
    {
        byte[] data;

        data = NetworkingMessageTranslator.GenerateUnitCommandNetworkingMessage(uc);

        // Reliable because we only send once.
        cc.Send(data, Valve.Sockets.SendFlags.Reliable, null);
    }
Exemplo n.º 31
0
        private void HandleGamepadButton(string buttonName, UnitCommand command, Unit unit, float amount)
        {
            var buttonDown = Input.GetButton(buttonName);

            if (buttonDown && command != null)
            {
                command.Execute(unit, amount);
            }
        }
 static bool Prefix(UnitCommand command)
 {
     if (IsInCombat() && command.Executor.IsInCombat)
     {
         command.Executor.UpdateCooldowns(command);
         return(false);
     }
     return(true);
 }
Exemplo n.º 33
0
    public static byte[] GenerateUnitCommandNetworkingMessage(UnitCommand uc)
    {
        NetworkingMessage nm = new NetworkingMessage();

        nm.type    = NetworkingMessageType.USER_COMMANDS;
        nm.content = ToByteArray(uc);

        return(ToByteArray(nm));
    }
Exemplo n.º 34
0
 public static UnitCommand unloadAll(Unit unit) {
   UnitCommand ret = new UnitCommand(bwapiPINVOKE.UnitCommand_unloadAll__SWIG_1(Unit.getCPtr(unit)), true);
   return ret;
 }
Exemplo n.º 35
0
 public static UnitCommand build(Unit unit, TilePosition target, UnitType type) {
   UnitCommand ret = new UnitCommand(bwapiPINVOKE.UnitCommand_build(Unit.getCPtr(unit), TilePosition.getCPtr(target), UnitType.getCPtr(type)), true);
   if (bwapiPINVOKE.SWIGPendingException.Pending) throw bwapiPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
Exemplo n.º 36
0
 public static UnitCommand attack(Unit unit, Position target) {
   UnitCommand ret = new UnitCommand(bwapiPINVOKE.UnitCommand_attack__SWIG_1(Unit.getCPtr(unit), Position.getCPtr(target)), true);
   if (bwapiPINVOKE.SWIGPendingException.Pending) throw bwapiPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
Exemplo n.º 37
0
 public bool opGreaterThan(UnitCommand other) {
   bool ret = bwapiPINVOKE.UnitCommand_opGreaterThan(swigCPtr, UnitCommand.getCPtr(other));
   if (bwapiPINVOKE.SWIGPendingException.Pending) throw bwapiPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
Exemplo n.º 38
0
 public static UnitCommand useTech(Unit unit, TechType tech, Unit target) {
   UnitCommand ret = new UnitCommand(bwapiPINVOKE.UnitCommand_useTech__SWIG_2(Unit.getCPtr(unit), TechType.getCPtr(tech), Unit.getCPtr(target)), true);
   if (bwapiPINVOKE.SWIGPendingException.Pending) throw bwapiPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
Exemplo n.º 39
0
 public static UnitCommand cancelTrain(Unit unit) {
   UnitCommand ret = new UnitCommand(bwapiPINVOKE.UnitCommand_cancelTrain__SWIG_1(Unit.getCPtr(unit)), true);
   return ret;
 }
Exemplo n.º 40
0
 public static UnitCommand rightClick(Unit unit, Unit target) {
   UnitCommand ret = new UnitCommand(bwapiPINVOKE.UnitCommand_rightClick__SWIG_3(Unit.getCPtr(unit), Unit.getCPtr(target)), true);
   return ret;
 }
Exemplo n.º 41
0
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(UnitCommand obj) {
   return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
 }
Exemplo n.º 42
0
 public static UnitCommand holdPosition(Unit unit) {
   UnitCommand ret = new UnitCommand(bwapiPINVOKE.UnitCommand_holdPosition__SWIG_1(Unit.getCPtr(unit)), true);
   return ret;
 }
Exemplo n.º 43
0
 public static UnitCommand holdPosition(Unit unit, bool shiftQueueCommand) {
   UnitCommand ret = new UnitCommand(bwapiPINVOKE.UnitCommand_holdPosition__SWIG_0(Unit.getCPtr(unit), shiftQueueCommand), true);
   return ret;
 }
Exemplo n.º 44
0
 public static UnitCommand setRallyPoint(Unit unit, Unit target) {
   UnitCommand ret = new UnitCommand(bwapiPINVOKE.UnitCommand_setRallyPoint__SWIG_1(Unit.getCPtr(unit), Unit.getCPtr(target)), true);
   return ret;
 }
Exemplo n.º 45
0
 public static UnitCommand upgrade(Unit unit, UpgradeType upgrade) {
   UnitCommand ret = new UnitCommand(bwapiPINVOKE.UnitCommand_upgrade(Unit.getCPtr(unit), UpgradeType.getCPtr(upgrade)), true);
   if (bwapiPINVOKE.SWIGPendingException.Pending) throw bwapiPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
Exemplo n.º 46
0
 public static UnitCommand research(Unit unit, TechType tech) {
   UnitCommand ret = new UnitCommand(bwapiPINVOKE.UnitCommand_research(Unit.getCPtr(unit), TechType.getCPtr(tech)), true);
   if (bwapiPINVOKE.SWIGPendingException.Pending) throw bwapiPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
Exemplo n.º 47
0
 public static UnitCommand morph(Unit unit, UnitType type) {
   UnitCommand ret = new UnitCommand(bwapiPINVOKE.UnitCommand_morph(Unit.getCPtr(unit), UnitType.getCPtr(type)), true);
   if (bwapiPINVOKE.SWIGPendingException.Pending) throw bwapiPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
Exemplo n.º 48
0
 public static UnitCommand rightClick(Unit unit, Position target, bool shiftQueueCommand) {
   UnitCommand ret = new UnitCommand(bwapiPINVOKE.UnitCommand_rightClick__SWIG_0(Unit.getCPtr(unit), Position.getCPtr(target), shiftQueueCommand), true);
   if (bwapiPINVOKE.SWIGPendingException.Pending) throw bwapiPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
Exemplo n.º 49
0
 public static UnitCommand rightClick(Unit unit, Unit target, bool shiftQueueCommand) {
   UnitCommand ret = new UnitCommand(bwapiPINVOKE.UnitCommand_rightClick__SWIG_2(Unit.getCPtr(unit), Unit.getCPtr(target), shiftQueueCommand), true);
   return ret;
 }
Exemplo n.º 50
0
 public static UnitCommand returnCargo(Unit unit) {
   UnitCommand ret = new UnitCommand(bwapiPINVOKE.UnitCommand_returnCargo__SWIG_1(Unit.getCPtr(unit)), true);
   return ret;
 }
Exemplo n.º 51
0
 public static UnitCommand haltConstruction(Unit unit) {
   UnitCommand ret = new UnitCommand(bwapiPINVOKE.UnitCommand_haltConstruction(Unit.getCPtr(unit)), true);
   return ret;
 }
Exemplo n.º 52
0
 public static UnitCommand repair(Unit unit, Unit target) {
   UnitCommand ret = new UnitCommand(bwapiPINVOKE.UnitCommand_repair__SWIG_1(Unit.getCPtr(unit), Unit.getCPtr(target)), true);
   return ret;
 }
Exemplo n.º 53
0
 public static UnitCommand cancelUpgrade(Unit unit) {
   UnitCommand ret = new UnitCommand(bwapiPINVOKE.UnitCommand_cancelUpgrade(Unit.getCPtr(unit)), true);
   return ret;
 }
Exemplo n.º 54
0
 public static UnitCommand lift(Unit unit) {
   UnitCommand ret = new UnitCommand(bwapiPINVOKE.UnitCommand_lift(Unit.getCPtr(unit)), true);
   return ret;
 }
Exemplo n.º 55
0
 public static UnitCommand placeCOP(Unit unit, TilePosition target) {
   UnitCommand ret = new UnitCommand(bwapiPINVOKE.UnitCommand_placeCOP(Unit.getCPtr(unit), TilePosition.getCPtr(target)), true);
   if (bwapiPINVOKE.SWIGPendingException.Pending) throw bwapiPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
Exemplo n.º 56
0
 public static UnitCommand unload(Unit unit, Unit target) {
   UnitCommand ret = new UnitCommand(bwapiPINVOKE.UnitCommand_unload(Unit.getCPtr(unit), Unit.getCPtr(target)), true);
   return ret;
 }
Exemplo n.º 57
0
public bool Equals(UnitCommand obj) 
{
    if (obj == null) return false;
    return (obj.swigCPtr.Handle == this.swigCPtr.Handle);
}
Exemplo n.º 58
0
 public static UnitCommand unloadAll(Unit unit, bool shiftQueueCommand) {
   UnitCommand ret = new UnitCommand(bwapiPINVOKE.UnitCommand_unloadAll__SWIG_0(Unit.getCPtr(unit), shiftQueueCommand), true);
   return ret;
 }
Exemplo n.º 59
0
 public static UnitCommand gather(Unit unit, Unit target, bool shiftQueueCommand) {
   UnitCommand ret = new UnitCommand(bwapiPINVOKE.UnitCommand_gather__SWIG_0(Unit.getCPtr(unit), Unit.getCPtr(target), shiftQueueCommand), true);
   return ret;
 }
Exemplo n.º 60
0
    public virtual void setTarget(GameObject target, int priority)
    {
        if(unitCombatTarget != null) {
            unitCombatTarget.SendMessage("removeUnitTargetingMe", this, SendMessageOptions.DontRequireReceiver);
        }
        CancelInvoke("attackTarget");

        if(target == null) {
            unitTargetPriority = priority;
            unitCombatTarget = null;
        }
        else if(priority > unitTargetPriority) {
            unitTargetPriority = priority;
            unitCombatTarget = target;
            unitCommand = UnitCommand.Attack;

            unitCombatTarget.SendMessage("addUnitTargetingMe", this, SendMessageOptions.DontRequireReceiver);

            if(unitCombatTarget.GetComponent<NavMeshAgent>()) {
                enemyUnitRadius = unitCombatTarget.GetComponent<NavMeshAgent>().radius;
            } else {
                enemyUnitRadius = 0.5f;
            }
        }
    }