Beispiel #1
0
        public static UnitStatus CreateFromType(statusTypes type, float duration, float power)
        {
            UnitStatus tmp = null;

            switch (type)
            {
            case statusTypes.Stun:
                tmp = new StunStatus();
                break;

            case statusTypes.Root:
                tmp = new RootStatus();
                break;

            case statusTypes.Speed:
                tmp = new SpeedStatus();
                ((SpeedStatus)tmp).speedModifier = power;
                break;
            }
            if (tmp != null)
            {
                tmp.duration = duration;
            }
            return(tmp);
        }
Beispiel #2
0
        public override void Launch()
        {
            UnitHealth enemyUnit;

            foreach (RaycastHit hit in Physics.BoxCastAll(spellIndicator.transform.position, new Vector3(spellRange, 2f, 2f), Vector3.up))
            {
                if (hit.collider.tag != this.tag && (enemyUnit = hit.collider.GetComponent <UnitHealth>()) != null)
                {
                    enemyUnit.TakeDamage(spellPower);
                }
            }
            Destroy(spellIndicator);
            unit.GetComponent <Rigidbody>().AddForce(-unit.transform.forward * 50f, ForceMode.VelocityChange);
            rootStatus = new RootStatus();
            if (!rootStatus.Init(unit.GetComponent <Unit>()))
            {
                rootStatus = null;
            }
            phaseStatus = new PhaseStatus();
            if (!phaseStatus.Init(unit.GetComponent <Unit>()))
            {
                phaseStatus = null;
            }
            jumpTimer = jumpLenght;
        }
Beispiel #3
0
 public override void Init(string tag, GameObject unit)
 {
     base.Init(tag, unit);
     spellIndicator.GetComponent <DecalProjectorComponent>().m_Size = new Vector3(spellRange * 2f, 2f, 1f);
     material   = spellIndicator.GetComponent <DecalProjectorComponent>().m_Material;
     rootStatus = new RootStatus();
     if (!rootStatus.Init(unit.GetComponent <Unit>()))
     {
         rootStatus = null;
     }
     unit.GetComponentInChildren <Animator>().SetBool("FireRoot", true);
 }
Beispiel #4
0
        public override void Launch()
        {
            Destroy(spellIndicator);
            spellIndicator = null;
            unit.GetComponent <UnitStatusManager>().UnRegisterStatus(rootStatus);
            if (rootStatus != null)
            {
                rootStatus.OnStatusEnd(unit.GetComponent <Unit>());
                rootStatus = null;
            }
            unit.GetComponentInChildren <Animator>().SetBool("FireRoot", false);
            base.Launch();
            int projectileCount = (int)Mathf.Clamp(castTime / chargeTime, 1f, maxCharge);

            for (int i = 0; i < projectileCount; i++)
            {
                Invoke("SpawnProjectile", (float)i * 0.1f);
            }
            Invoke("Effect", (float)projectileCount * 0.1f);
        }
Beispiel #5
0
 protected override void Update()
 {
     if (jumpTimer > 0f)
     {
         jumpTimer -= Time.deltaTime;
         if (jumpTimer < 0f)
         {
             if (rootStatus != null)
             {
                 rootStatus.OnStatusEnd(unit.GetComponent <Unit>());
                 rootStatus = null;
             }
             if (phaseStatus != null)
             {
                 phaseStatus.OnStatusEnd(unit.GetComponent <Unit>());
                 phaseStatus = null;
             }
             unit.GetComponent <Rigidbody>().velocity = new Vector3(0f, 0f, 0f);
             Clean();
         }
     }
 }