public override bool ExecuteAnimation(SimulatedDisplacement sim, Direction dir, Board board)
    {
        //Clean Up all spawned anims
        foreach (KeyValuePair <Tile, GameObject> pair in ((LancePoke)action).spawnedLanceAnims)
        {
            UnitAnimator animator = pair.Value.GetComponent <UnitAnimator>();
            animator.SetBool("EndAnimation", true);
        }

        //Remove references
        ((LancePoke)action).spawnedLanceAnims.Clear();
        return(true);
    }
Esempio n. 2
0
        public sealed override void Init(int HP, int damage,  List<Vector3Int> path) // 필요한 스탯 최대체력 체력 공격력 공격범위, 
        {
            if (UnitAnimator == null)
            {
                UnitAnimator = gameObject.transform.GetChild(0).GetComponent<Animator>();
            }
            else
            {
                UnitAnimator.Rebind();
                UnitAnimator.SetBool("dead", false);
            }

            gameObject.transform.GetChild(0).transform.localPosition = new Vector3(Random.Range(-0.1f, 0.1f), 0.1f, -0.3f + Random.Range(-0.1f, 0.1f));

            unitName = "Kong";

            spriteRenderer = gameObject.gameObject.transform.GetChild(0).GetComponent<SpriteRenderer>();
            spriteRenderer.material.color = new Color(1, 1, 1, 1);

            spriteRenderer.flipX = true;
            monsterTransform = gameObject.transform;

            DamageMultiplier = 1;
            AdditionalDamage = 0;
            MaxHP = HP;
            this.HP = HP;
            Damage = damage;
            AttackDelay = ATTACK_DELAY;
            speed = SPEED;
            CurrentAttackDelay = AttackDelay;

            pathList.Clear();
            foreach (var pos in path)
                pathList.Add(pos);

            this.gameObject.transform.position = pathList[0];
            UnitPosition = pathList[0];

            currentState = MonsterUnitState.SetPath;

            GameManager.Instance.AddUpdate(this);
            GameManager.Instance.MessageSystem.Subscribe(typeof(PlayerUnitSummonEvent), this);
            GameManager.Instance.MessageSystem.Subscribe(typeof(DamageEvent), this);

            for (int i = -2; i < 3; i++)
            {
                rangeTile.Add(new Vector3Int(i, 0, -1));
                rangeTile.Add(new Vector3Int(i, 0, 0));
                rangeTile.Add(new Vector3Int(i, 0, 1));
            }
        }
Esempio n. 3
0
 public sealed override void Attack()
 {
     if (Target.HP > 0 && CheckMonsterInRange())
     {
         StartCoroutine("AttackRoutine");
         UnitAnimator.SetBool("attack", true);
     }
     else
     {
         UnitAnimator.SetBool("attack", false);
         Target = null;
         if (CheckRangeTileTarget() == false)
         {
             CurrentAttackDelay = AttackDelay;
             currentState       = PlayerUnitState.Idle;
         }
     }
 }
Esempio n. 4
0
        public override void UpdateFrame(float dt)
        {
            switch (currentState)
            {
            case PlayerUnitState.Init:
                if (CheckRangeTileTarget() == true)
                {
                    currentState = PlayerUnitState.Attack;
                }
                else
                {
                    currentState = PlayerUnitState.Idle;
                }
                break;

            case PlayerUnitState.Idle:
                if (CurrentAttackDelay <= AttackDelay)
                {
                    CurrentAttackDelay += dt;
                }
                break;

            case PlayerUnitState.Attack:
                if (CurrentAttackDelay > AttackDelay)
                {
                    ResetBlinkCount();
                    CurrentAttackDelay = 0;
                    Attack();
                }
                else
                {
                    UnitAnimator.SetBool("attack", false);
                    CurrentAttackDelay += dt;
                }
                break;

            case PlayerUnitState.Dead:
                StartCoroutine("Dead");
                break;

            default:
                break;
            }
        }
Esempio n. 5
0
        public sealed override IEnumerator Dead()
        {
            Dispose(false);

            GameManager.Instance.MessageSystem.Publish(PlayerUnitDeadEvent.Create(UnitPosition, this));
            UnitAnimator.SetBool("dead", true);
            yield return(new WaitForSeconds(1f));

            float alpha = gameObject.transform.GetComponent <SpriteRenderer>().material.color.a;

            for (float t = 0.0f; t < 1.0f; t += Time.deltaTime / 1)
            {
                Color newColor = new Color(1, 1, 1, Mathf.Lerp(alpha, 0, t));
                transform.GetComponent <SpriteRenderer>().material.color = newColor;
                yield return(null);
            }
            UnitAnimator.SetBool("dead", false);
            FieldObjectManager.Instance.ReleaseUnit(unitName, this);
        }
Esempio n. 6
0
        public sealed override IEnumerator Dead()
        {
            Dispose(false);

            GameManager.Instance.MessageSystem.Publish(MonsterDeadEvent.Create(this, UnitPosition));
            UnitAnimator.SetBool("dead", true);
            yield return(new WaitForSeconds(0.2f));

            GameManager.Instance.EffectSystem.CreateEffect("DeathStandard", this.gameObject.transform.position + new Vector3(0, 0.1f, -0.1f), new Vector3(0.25f, 0.25f, 0.25f), Quaternion.Euler(new Vector3(-90, 0, 0)), 2);
            SoundManager.Instance.PlaySfx("Weird0" + Random.Range(1, 5), 0.1f);
            yield return(new WaitForSeconds(0.1f));

            float alpha = spriteRenderer.material.color.a;

            for (float t = 0.0f; t < 1.0f; t += Time.deltaTime / 1)
            {
                Color newColor = new Color(1, 1, 1, Mathf.Lerp(alpha, 0, t));
                spriteRenderer.material.color = newColor;
                yield return(null);
            }
            UnitAnimator.SetBool("dead", false);
            FieldObjectManager.Instance.ReleaseUnit(unitName, this);
        }
Esempio n. 7
0
    //end navmesh values



    //Setting States
    void SetIncombat(bool _bool)
    {
        incombat = _bool;
        unitAnimator.SetBool("InCombat", _bool);
    }