Example #1
0
    public void Init(Unit.OnHit onHit)
    {
        _intell.UnitPrimaryState = UnitPrimaryState.Idle;

        AxeHitArea.Init(onHit, Intell.IAm == IAm.Ally ? IAm.Enemy.ToString() : IAm.Ally.ToString());
        AxeHitArea.gameObject.SetActive(false);

        if (Stats.AttackSpeed == 0)
        {
            Stats.AttackSpeed = FightUtils.GetDefaultAttackSpeed(Avatar, "Reload_Body_2", "Attack_Body_2");
        }

        AttackSpeedChanged();
    }
Example #2
0
        internal static Projectile GetAvailableProjectile(
            List <Projectile> gameObjects,
            CreateProjectile createProjectile,
            Unit.OnHit onHit,
            IAm iAm,
            ref int?projectileIndex
            )
        {
            Projectile go = null;
            int        i  = 0;

            foreach (Projectile obj in gameObjects)
            {
                if (obj.Available == true)
                {
                    go = obj;
                    projectileIndex = i;
                    //Debug.Log(obj.gameObject.activeSelf + " :" + DateTime.Now);
                    break;
                }
                i++;
            }

            if (go == null)
            {
                HitArea arrowHitArea = null;
                go = createProjectile(go);
                foreach (Transform hA in go.transform)
                {
                    arrowHitArea = hA.GetComponent <HitArea>();
                    if (arrowHitArea != null)
                    {
                        break;
                    }
                }
                if (arrowHitArea != null)
                {
                    arrowHitArea.Init(onHit, iAm.ToString(), isProjectile: true, projectile: go);
                }

                return(go);
            }
            else
            {
                return(null);
            }
        }