protected override void StateChanged()
    {
        switch ((EntityState)prevState)
        {
        case EntityState.Normal:
            CancelInvoke("DoActiveCheck");
            launcherAnim.Stop();
            break;
        }

        base.StateChanged();

        switch ((EntityState)state)
        {
        case EntityState.Normal:
            if (mPlayers == null)
            {
                mPlayers = GameObject.FindGameObjectsWithTag("Player");
            }

            if (!IsInvoking("DoActiveCheck"))
            {
                InvokeRepeating("DoActiveCheck", 0, activateCheckDelay);
            }
            break;
        }
    }
예제 #2
0
 public void StopOverrideTake()
 {
     if (anim && mOverrideTake != null)
     {
         anim.Stop();
         mOverrideTake = null;
     }
 }
예제 #3
0
    /// <summary>
    /// This is called after death or when set to sleep,
    /// Use this to reset states.  The base will reset stats and telemetry
    /// </summary>
    protected virtual void Restart()
    {
        //reset physics
        SetPhysicsActive(true, false);

        if (animator)
        {
            animator.Stop();
        }

        if (visibleGO)
        {
            visibleGO.SetActive(true);
        }

        //reset blink
        Blink(0.0f);

        mStats.Reset();
        mStats.isInvul = true;

        if (FSM)
        {
            FSM.Reset();
        }

        if (mBodyCtrl)
        {
            mBodyCtrl.enabled = true;
        }

        Jump(0.0f);

        if (stunGO)
        {
            stunGO.SetActive(false);
        }

        StopCoroutine(DoRespawnWaitDelayKey);

        mLastStunnedTime = 0.0f;
    }
    public override void Release()
    {
        AnimatorData animDat = target ? target : GetComponent <AnimatorData>();

        animDat.takeCompleteCallback -= OnAnimationComplete;
        animDat.Stop();

        if (mMover)
        {
            mMover.localPosition          = Vector3.zero;
            stats.transform.localPosition = Vector3.zero;
        }

        base.Release();
    }
예제 #5
0
    public void ResetData()
    {
        mVerticalMoveActive = false;
        mLastMoveVertical   = 0.0f;

        mHurtForceDelay = 0.0f;

        if (bombGrabber)
        {
            bombGrabber.gameObject.SetActive(false);
        }

        foreach (SpriteColorBlink blink in spriteBlinks)
        {
            if (blink)
            {
                blink.enabled = false;
            }
        }

        if (attachAnimator)
        {
            attachAnimator.transform.localScale = Vector3.one;
            attachAnimator.Stop();
        }

        if (mBody)
        {
            mBody.ResetCollision();
            mBody.eyeOfs = Vector3.zero;
        }

        if (mBodySpriteCtrl)
        {
            mBodySpriteCtrl.ResetAnimation();
        }

        if (attachSpriteAnim)
        {
            attachSpriteAnim.Sprite.FlipX = false;
        }

        if (mBombCtrl)
        {
            mBombCtrl.Init();
        }

        if (mPlayer)
        {
            HUD hud = mPlayer.HUD;
            if (hud)
            {
                if (hud.tickerLabel)
                {
                    hud.tickerLabel.gameObject.SetActive(false);
                }

                if (hud.targetOffScreen)
                {
                    hud.targetOffScreen.gameObject.SetActive(false);
                }
            }
        }

        mThrowMode = ThrowMode.None;

        if (attachPoint)
        {
            attachPoint.localRotation = Quaternion.identity;
        }

        doubleJumpAnim.Stop();
    }
예제 #6
0
    public void ThrowAttach()
    {
        switch (mThrowMode)
        {
        case ThrowMode.None:
            if (!CheckBombCollideAt(throwPoint.position))
            {
                DoThrow(throwPoint.position, throwSpeed, throwAngle, true);
            }
            else
            {
                attachAnimator.Stop();
            }
            break;

        case ThrowMode.Up:
            if (!CheckBombCollideAt(throwPoint.position))
            {
                DoThrow(throwPoint.position, throwSpeed, 90.0f, false);
            }
            else
            {
                attachAnimator.Stop();
            }
            break;

        case ThrowMode.Down:
            float   r    = mBodySpriteCtrl.isLeft ? Mathf.PI * 0.5f : -Mathf.PI * 0.5f;
            Vector3 lpos = mBody.transform.worldToLocalMatrix.MultiplyPoint(throwPoint.position);

            //try downward
            Vector2 p2 = M8.MathUtil.Rotate(lpos, r * 2.0f);
            lpos.x = p2.x; lpos.y = p2.y;

            Matrix4x4 mtx = mBody.transform.localToWorldMatrix;
            Vector3   pos = mtx.MultiplyPoint(lpos);

            if (!CheckBombCollideAt(pos))
            {
                DoThrow(pos, throwSpeed, -90.0f, false);
            }
            else
            {
                int i = 0;
                for (; i < 3; i++)
                {
                    p2     = M8.MathUtil.Rotate(lpos, r);
                    lpos.x = p2.x; lpos.y = p2.y;
                    pos    = mtx.MultiplyPoint(lpos);

                    if (!CheckBombCollideAt(pos))
                    {
                        break;
                    }
                }

                if (i < 3)
                {
                    DoThrow(pos, 0.0f, 0.0f, true);
                }
            }
            break;
        }
    }
예제 #7
0
    void ToPhase(Phase phase)
    {
        if (mCurPhase == phase)
        {
            return;
        }

        //Debug.Log("phase: " + phase);

        bodySpriteCtrl.StopOverrideClip();

        //prev
        switch (mCurPhase)
        {
        case Phase.Idle:
            CancelInvoke(nextPhaseFunc);
            break;

        case Phase.ChargeToPlayer:
            StopCoroutine(chargeRoutine);
            chargeGO.SetActive(false);
            bodyCtrl.lockDrag = false;

            damageGO.SetActive(true);
            break;

        case Phase.ShootLasers:
            StopCoroutine(shootLasersRoutine);

            foreach (Transform t in laserPts)
            {
                t.gameObject.SetActive(false);
            }
            break;

        case Phase.Tornado:
            StopCoroutine(tornadoRoutine);
            tornadoAnimDat.Stop();
            bodyCtrl.lockDrag = false;
            break;
        }

        //new
        switch (phase)
        {
        case Phase.Idle:
            bodyCtrl.moveSide = 0.0f;
            //wait if we are in mid air
            if (bodyCtrl.isGrounded)
            {
                Invoke(nextPhaseFunc, idleWait);
            }
            break;

        case Phase.ChargeToPlayer:
            damageGO.SetActive(false);

            StartCoroutine(chargeRoutine);
            break;

        case Phase.ShootLasers:
            StartCoroutine(shootLasersRoutine);
            break;

        case Phase.Tornado:
            StartCoroutine(tornadoRoutine);
            break;

        case Phase.Dead:
            break;
        }

        mCurPhase = phase;
    }
예제 #8
0
 public void Stop()
 {
     mStopped = true;
     animDat.Stop();
     CancelInvoke("DoPlay");
 }