예제 #1
0
    //UPDATE POWER EFFECTS
    public override void deliverPowerEffects(PersonStatus status, AnimationScript animator, UnitNavigationController navigator)
    {
        if (status.UnitStatus != PersonStatus.Status.Raged && status.UnitStatus != PersonStatus.Status.Dead && !started)
        {
            started              = true;
            status.UnitStatus    = PersonStatus.Status.Panicked;
            animator.powerEffect = (GameObject)Instantiate(particleEffect, new Vector3(status.transform.position.x, status.transform.position.y + 0.9f, status.transform.position.z), Quaternion.identity);
            animator.powerEffect.transform.parent = animator.transform;
            status.Fear = Fear;
        }
        else if (status.UnitStatus != PersonStatus.Status.Raged && status.UnitStatus != PersonStatus.Status.Dead)
        {
            timer += Time.deltaTime;
            if (timer >= 10f)
            {
                status.Fear       = 0;
                status.UnitStatus = PersonStatus.Status.Dead;
                navigator.Stop();
                started = false;
            }
        }

        if (status.UnitStatus == PersonStatus.Status.Dead)
        {
            Destroy(animator.powerEffect, 3f);
            status.ActivePower = null;
        }
    }
예제 #2
0
    public override void deliverPowerEffects(PersonStatus status, AnimationScript animator, UnitNavigationController navigator)
    {
        if (status.UnitStatus != PersonStatus.Status.Raged && status.UnitStatus != PersonStatus.Status.Dead)
        {
            timer             = 0;
            status.UnitStatus = PersonStatus.Status.Raged;
            navigator.Stop();
            animator.powerEffect = (GameObject)Instantiate(particleEffect, new Vector3(status.transform.position.x, status.transform.position.y + 0.9f, status.transform.position.z), Quaternion.identity);
            animator.powerEffect.transform.parent = animator.transform;
            status.Fear = Fear;
        }
        else
        {
            timer += Time.deltaTime;
            if (timer >= 10f)
            {
                status.UnitStatus = PersonStatus.Status.Concerned;
                status.Fear       = 0;
                Destroy(animator.powerEffect);
                status.ActivePower = null;
                navigator.SetNewPatrolDestination(navigator.Type);
                navigator.target = null;
            }
        }

        if (status.UnitStatus == PersonStatus.Status.Dead)
        {
            if (animator.powerEffect != null)
            {
                Destroy(animator.powerEffect);
            }
        }
    }
예제 #3
0
    public override void deliverPowerEffects(PersonStatus status, AnimationScript animator, UnitNavigationController navigator)
    {
        if (status.UnitStatus != PersonStatus.Status.Dead && timer == 0)
        {
            status.Fear = 0;
            navigator.Stop();
            status.UnitStatus = PersonStatus.Status.Idle;

            if (animator.powerEffect)
            {
                Object.Destroy(animator.powerEffect);
            }

            animator.powerEffect = (GameObject)Object.Instantiate(owner.particleEffect, new Vector3(status.transform.position.x, status.transform.position.y + 0f, status.transform.position.z), Quaternion.identity);
            animator.powerEffect.transform.parent = animator.transform;
        }

        timer      += Time.deltaTime;
        status.Fear = 0;

        if (timer >= 10)
        {
            Object.Destroy(animator.powerEffect);
            status.UnitStatus = PersonStatus.Status.Calm;
            navigator.SetNewPatrolDestination(navigator.Type);
            status.ActivePower = null;
        }
    }
예제 #4
0
    public override void runNavigatorUpdate(UnitNavigationController navigator)
    {
        SetTarget(navigator.gameObject, navigator);

        if (navigator.target == null)
        {
            navigator.Stop();
            stop = true;
        }
        else
        {
            navigator.SetNavDestination(navigator.target.transform.position);
        }

        if (!stop)
        {
            navigator.SetSpeed(speed);
        }
    }
예제 #5
0
    //UPDATE POWER EFFECTS
    public override void deliverPowerEffects(PersonStatus status, AnimationScript animator, UnitNavigationController navigator)
    {
        if (status.UnitStatus != PersonStatus.Status.Raged && status.UnitStatus != PersonStatus.Status.Dead && !started)
        {
            if (animator.powerEffect)
            {
                Object.Destroy(animator.powerEffect);
            }

            if (Application.loadedLevelName == "TowerDefense")
            {
                burnTime = 3f;
            }
            started              = true;
            status.UnitStatus    = PersonStatus.Status.Panicked;
            animator.powerEffect = (GameObject)Object.Instantiate(owner.particleEffect, new Vector3(status.transform.position.x, status.transform.position.y + 0.9f, status.transform.position.z), Quaternion.identity);
            animator.powerEffect.transform.parent = animator.transform;
            status.Fear = owner.Fear;
        }
        else if (status.UnitStatus != PersonStatus.Status.Raged && status.UnitStatus != PersonStatus.Status.Dead)
        {
            timer += Time.deltaTime;

            if (timer >= burnTime)
            {
                status.Fear       = 0;
                status.UnitStatus = PersonStatus.Status.Dead;
                navigator.Stop();
                started = false;
            }
        }

        if (status.UnitStatus == PersonStatus.Status.Dead)
        {
            Object.Destroy(animator.powerEffect, 3f);
            status.ActivePower = null;
        }
    }
예제 #6
0
    //UPDATE POWER EFFECTS
    public override void deliverPowerEffects(PersonStatus status, AnimationScript animator, UnitNavigationController navigator)
    {
        if (timer == 0)
        {
            if (animator.powerEffect)
            {
                Object.Destroy(animator.powerEffect);
            }

            var renderers = status.gameObject.transform.GetComponentsInChildren <SkinnedMeshRenderer>();

            foreach (var renderer in renderers)
            {
                if (renderer.gameObject.name == "Character01")
                {
                    renderer.material.mainTexture = (Texture2D)Resources.Load("Character01Zombie", typeof(Texture2D));
                }
            }

            status.UnitStatus = PersonStatus.Status.Zombie;
            navigator.Stop();
            halfSpeed            = speed / 2;
            thirdSpeed           = speed / 3;
            animator.powerEffect = (GameObject)Object.Instantiate(owner.particleEffect, new Vector3(status.transform.position.x, status.transform.position.y + 0.9f, status.transform.position.z), Quaternion.identity);
            animator.powerEffect.transform.parent = animator.transform;
            status.Fear = owner.Fear;
        }

        timer += Time.deltaTime;

        if (timer >= (aliveTime * 0.25f) && timer <= (aliveTime * 0.75f) && !stop)
        {
            //Debug.Log(speed);
            speed = halfSpeed;
            animator.SetSpeed(animator.MiddleSpeed);
        }

        /*
         * if(timer >= (aliveTime * 0.5f) && timer <= (aliveTime * 0.75f))
         * {
         *      Debug.Log(speed);
         *      speed = speed / 2;
         * }
         */

        if (timer >= (aliveTime * 0.75f) && !stop)
        {
            //Debug.Log(speed);
            speed = thirdSpeed;
            animator.SetSpeed(0.5f);
            animator.SetSpeed(animator.WalkingSpeed);
        }

        if (stop)
        {
            animator.SetSpeed(0);
        }

        if (timer >= aliveTime)
        {
            status.UnitStatus = PersonStatus.Status.Dead;
            status.Fear       = 0;
            Object.Destroy(animator.powerEffect);
        }
    }