Пример #1
0
    public void addPickupItem(TacticPickup pickup)
    {
        if (pickup.GetPickupType() == TacticPickup.PickupType.Chest)
        {
            this.health += ((TreasureChest)pickup).getCoins();
            if (health > this.maxHealth)
            {
                health = this.maxHealth;
            }
        }

        //Add scenerios for potions later@TODO
    }
Пример #2
0
    public void Update()
    {
        this.TacticActorUpdate();

        Tile t = null;

        if (bMinionSelected && currentState == ActorState.Move)
        {
            if (CheckMouseClick("Tile") && GetIsMoving() == false)
            {
                RaycastHit hit = GetMouseHit();
                t = hit.collider.GetComponentInParent <Tile> ();

                if (t != null && t.bSelectable)
                {
                    t.bTargetTile = true;
                    this.SetIsMoving(true);
                    this.MoveToTile(t);
                }
            }

            if (this.GetIsMoving())
            {
                this.MoveOneStep();
                if (!this.GetIsMoving())                  //when stopped
                {
                    this.bMinionSelected = false;
                }
            }

            //Temp pickup code
            if (CheckMouseClick("Pickup") && GetIsMoving() == false)
            {
                RaycastHit   hit    = GetMouseHit();
                TacticPickup pickup = hit.collider.gameObject.GetComponent <TacticPickup> ();
                if (pickup && DetectPickup(pickup.GetComponent <Collider> ()))
                {
                    pickup.Pickup(this);
                    this.ResetTiles();
                    this.currentState = ActorState.Idle;
                    bMinionSelected   = false;
                }
            }
        }

        if (bMinionSelected && currentState == ActorState.Attack && bHasActed == false)
        {
            if (CheckMouseClick("Minion"))
            {
                RaycastHit hit         = GetMouseHit();
                GameActor  targetActor = hit.collider.GetComponentInParent <GameActor> ();
                t = GetTargetTile(targetActor.gameObject);
                if (targetActor != null && t.bSelectable)
                {
                    t.bTargetTile = true;
                    RotateTowardTarget(targetActor);
                    targetActor.TakeDamage(this.GetAttackDamage());
                    bHasActed = true;
                    this.PlayAttackAnimation();
                    this.ResetTiles();
                }
            }
        }
    }