Ejemplo n.º 1
0
    protected override void StateChanged()
    {
        switch ((EntityState)prevState)
        {
        case EntityState.Normal:
            ToPhase(Phase.None);
            break;
        }

        base.StateChanged();

        switch ((EntityState)state)
        {
        case EntityState.Normal:
            DoNextPhase();
            break;

        case EntityState.Dead:
            mAnimDat.Play(takeDefeat);

            ToPhase(Phase.Dead);
            break;

        case EntityState.Invalid:
            ToPhase(Phase.None);
            break;
        }
    }
Ejemplo n.º 2
0
 public void PlayOverrideTake(string take)
 {
     //assume its loop type is 'once'
     if (anim && anim.TakeExists(take))
     {
         mOverrideTake = take;
         anim.Play(mOverrideTake);
     }
 }
Ejemplo n.º 3
0
    /*public override bool canFire {
     *  get { return Player.instance.stats.energyShieldIsActive || base.canFire; }
     * }*/

    protected override Projectile CreateProjectile(int chargeInd, Transform seek)
    {
        PlayerStats pstat = Player.instance.stats;

        if (pstat.energyShieldIsActive)
        {
            if (mStrikeActives == 0)
            {
                PerformStrike(null, spawnPoint, pstat.energyShieldActivePointCount - 1);
                if (mStrikeActives > 0)
                {
                    if (fireActiveAnimDat)
                    {
                        fireActiveAnimDat.Play("fire");
                    }

                    pstat.EnergyShieldSetActive(false);

                    fireSfx.Play();
                }
            }
        }
        else
        {
            pstat.EnergyShieldSetActive(true);
            currentEnergy -= charges[chargeInd].energyCost;

            chargeSfx.Play();
        }

        return(null);
    }
Ejemplo n.º 4
0
    void DoActiveCheck()
    {
        mTarget = null;
        Vector3 pos        = transform.position;
        float   nearestSqr = Mathf.Infinity;

        for (int i = 0, max = mPlayers.Length; i < max; i++)
        {
            if (mPlayers[i].activeSelf)
            {
                Vector3 dpos    = mPlayers[i].transform.position - pos;
                float   distSqr = dpos.sqrMagnitude;
                if (distSqr < nearestSqr)
                {
                    nearestSqr = distSqr;
                    mTarget    = mPlayers[i].transform;
                }
            }
        }

        if (mTarget != null && nearestSqr < activateRange * activateRange)
        {
            CancelInvoke("DoActiveCheck");

            float faceSign = Mathf.Sign(mTarget.position.x - transform.position.x);
            for (int i = 0, max = mSprites.Length; i < max; i++)
            {
                mSprites[i].FlipX = faceSign < 0.0f ? leftIsFlip : !leftIsFlip;
            }

            launcherAnim.Play(launcherFireTake);
        }
    }
Ejemplo n.º 5
0
    public bool Click(tk2dSpriteAnimator animSpr, AnimatorData toPlay, string take)
    {
        if (mIsFinalLevel)
        {
            //if unlocked, load level
            if (finalActiveGO.activeSelf)
            {
                Main.instance.sceneManager.LoadScene(Scenes.finalStages);
                return(true);
            }
        }
        else
        {
            if (inactive.activeSelf)
            {
                Main.instance.sceneManager.LoadScene(level);
                return(true);
            }
            else
            {
                //start intro
                UIModalManager.instance.ModalCloseAll();
                animSpr.Library = animRef;
                LevelSelectCharacterControl.instance.toScene = level;
                LevelSelectCharacterControl.instance.SetAnimWatch(toPlay);
                toPlay.Play(take);
                return(true);
            }
        }

        return(false);
    }
Ejemplo n.º 6
0
    public override void FireStart()
    {
        if (canFire && !mFireActive)
        {
            mFireActive = true;

            Player player = Player.instance;

            player.controllerSprite.PlayOverrideClip(clip);
            player.controllerSprite.useVelocitySpeed = true;

            player.controller.moveMaxSpeed = speed;
            player.controller.moveForce   *= 2.0f;
            player.controller.moveAirForce = player.controller.moveForce;

            Stats.DamageMod dmgReduce = player.stats.GetDamageMod(player.stats.damageTypeReduction, Damage.Type.Contact);
            if (dmgReduce != null)
            {
                dmgReduce.val = 1.0f;
            }

            hoolaAnimDat.Play("active");

            damageGO.SetActive(true);
        }
    }
Ejemplo n.º 7
0
    IEnumerator DoGroundCast()
    {
        bodyCtrl.moveSide = 0.0f;

        WaitForFixedUpdate wait = new WaitForFixedUpdate();

        do
        {
            yield return(wait);
        } while(!bodyCtrl.isGrounded);

        groundCastActiveGO.SetActive(true);

        bodySpriteCtrl.PlayOverrideClip(clipCast);

        yield return(new WaitForSeconds(groundCastStartDelay));

        groundCastSfx.Play();

        //set to player's x loc.
        Vector3 groundCastPos = groundCastSpell.transform.position;

        groundCastPos.x = mPlayer.transform.position.x;
        groundCastSpell.transform.position = groundCastPos;

        groundCastSpell.gameObject.SetActive(true);
        groundCastSpell.Play(takeGroundCast);
        while (groundCastSpell.isPlaying)
        {
            yield return(wait);
        }

        ToPhase(Phase.Idle);
    }
Ejemplo n.º 8
0
    protected override void StateChanged()
    {
        switch ((State)state)
        {
        case State.Invalid:
            if (mGameOverFX)
            {
                mGameOverFX.enabled = false;
            }

            mCurTime     = 0.0f;
            mTimerActive = false;

            mIsGoal = false;

            if (mHUD)
            {
                mHUD.ResetData();
            }
            break;

        case State.Normal:
            if (mHUD.timerEnabled && !mTimerActive)
            {
                mTimerActive = true;
                StartCoroutine(Timer());
            }
            break;

        case State.Dead:
            mNumDeath++;
            mIsGoal = false;
            break;

        case State.Victory:
            RemoveInput();

            //save level complete info
            LevelManager.instance.LevelComplete(mCurTime, mHUD.starsFilled, mNumDeath);

            mAnim.Play("exit");

            mTimerActive = false;
            break;
        }
    }
Ejemplo n.º 9
0
    IEnumerator DoDeath()
    {
        WaitForFixedUpdate wait = new WaitForFixedUpdate();

        mEyeLock = false;

        Holoville.HOTween.Tweener[] shakeTweens;

        deathSfx.Play();

        //shake
        shakeTweens = new Holoville.HOTween.Tweener[deathGOs.Length];
        for (int i = 0; i < deathGOs.Length; i++)
        {
            shakeTweens[i] = Holoville.HOTween.HOTween.Shake(deathGOs[i].transform, deathShakeDuration,
                                                             "localPosition", new Vector3(deathShakeAmount, 0, 0),
                                                             true, deathShakeAmp, deathShakePeriod);
            shakeTweens[i].loops = -1;
            shakeTweens[i].Play();
        }

        //wait
        yield return(new WaitForSeconds(deathFallStartDelay));

        //fade
        deathFader.gameObject.SetActive(true);
        deathFader.Play("fadeout");

        //fall down while fading
        float curFallVel = 0;

        while (deathFader.isPlaying)
        {
            for (int i = 0; i < deathGOs.Length; i++)
            {
                Vector3 pos = deathGOs[i].transform.position;
                pos.y -= curFallVel * Time.fixedDeltaTime;
            }

            curFallVel += deathFallAccel * Time.fixedDeltaTime;

            yield return(wait);
        }

        for (int i = 0; i < shakeTweens.Length; i++)
        {
            Holoville.HOTween.HOTween.Kill(shakeTweens[i]);
        }

        //deactivate self, go to next boss
        gameObject.SetActive(false);
        shieldGO.SetActive(false);
        armGO.SetActive(false);
        damageGO.SetActive(false);

        nextBossGO.SetActive(true);
    }
Ejemplo n.º 10
0
 void OnTriggerEnter(Collider col)
 {
     if (target != null)
     {
         if (forcePlay || !target.isPlaying)
         {
             target.Play(take);
         }
     }
 }
Ejemplo n.º 11
0
    void InitNormal()
    {
        mIsOpen = false;

        CancelInvoke(orientFunc);
        CancelInvoke(openFunc);

        cannonAnim.Play("normal");

        shellAnimDat.Play("normal");

        SetClosedState(true);

        Invoke(openFunc, openDelay);

        mDirCur      = Vector3.up;
        mDirAngle    = mDirAngleDest = 0.0f;
        mDirAngleVel = 0.0f;
    }
Ejemplo n.º 12
0
    protected override void OnOpen()
    {
        infoActiveGO.SetActive(false);

#if false
        //cheat
        Weapon.UnlockWeapon(1);
        Weapon.UnlockWeapon(2);
        Weapon.UnlockWeapon(3);
        Weapon.UnlockWeapon(4);
        Weapon.UnlockWeapon(5);
        Weapon.UnlockWeapon(6);

        for (int i = 0; i < mLevelItems.Length; i++)
        {
            if (!string.IsNullOrEmpty(mLevelItems[i].level))
            {
                SceneState.instance.SetGlobalValue(mLevelItems[i].level, 1, true);
                mLevelItems[i].Init();
            }
        }
#endif
        mLockInput = false;

        //check if we need to play boss intro
        bool initFinalLevelItem = true;

        if (UserData.instance.GetInt(levelSelectBossIntroUDKey, 0) == 0)
        {
            int completeCount = 0;
            for (int i = 0; i < mLevelItems.Length; i++)
            {
                if (mLevelItems[i] != finalLevel && mLevelItems[i] != gitgirl && mLevelItems[i].isCompleted)
                {
                    completeCount++;
                }
            }

            if (completeCount == mLevelItems.Length - 2)
            {
                mLockInput = true;
                UserData.instance.SetInt(levelSelectBossIntroUDKey, 1);
                bossAlertAnimDat.Play("go"); //animator will re-open this modal after the intro
                initFinalLevelItem = false;
            }
        }

        if (initFinalLevelItem)
        {
            finalLevel.InitFinalLevel(mLevelItems, gitgirl);
        }

        //reset some data
        Weapon.ResetWeaponEnergies();
    }
Ejemplo n.º 13
0
    protected override void StateChanged()
    {
        switch ((EntityState)prevState)
        {
        case EntityState.Normal:
            mEffinStuff.holder.gameObject.SetActive(false);

            StopCoroutine(attackRoutine);

            ToPhase(Phase.None);
            break;
        }

        base.StateChanged();

        switch ((EntityState)state)
        {
        case EntityState.Normal:
            wpAnimDat.Play("default");

            mEffinStuff.holder.gameObject.SetActive(true);

            anim.Play(clipNormal);

            mCurStuffState = StuffState.Start;
            ToPhase(Phase.StuffContract);

            StartCoroutine(attackRoutine);
            break;

        case EntityState.Dead:
            anim.Play(clipDefeat);
            mAnimDat.Play(takeDefeat);

            ToPhase(Phase.Dead);
            break;

        case EntityState.Invalid:
            ToPhase(Phase.None);
            break;
        }
    }
Ejemplo n.º 14
0
    /// <summary>
    /// Put bomb back on git girl's head.
    /// </summary>
    public void BombActive()
    {
        if (mBody)
        {
            mBody.ResetCollision();
        }

        if (bomb)
        {
            bomb.rigidbody.detectCollisions = false;
            bomb.SetActive(false);
        }

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

        if (mPlayer.bombEnabled)
        {
            if (attachSpriteAnim)
            {
                attachSpriteAnim.Play(attachSpriteClipBomb);
            }

            mPlayer.HUD.targetOffScreen.gameObject.SetActive(true);
        }
        else
        {
            if (attachSpriteAnim)
            {
                attachSpriteAnim.Play(attachSpriteClipEmpty);
            }

            mPlayer.HUD.targetOffScreen.gameObject.SetActive(false);
        }

        if (attachAnimator)
        {
            attachAnimator.Play("default");
        }
    }
Ejemplo n.º 15
0
    public void CollectStar(Collider col)
    {
        col.enabled = false;
        AnimatorData anim = col.GetComponent <AnimatorData>();

        anim.Play("collect");

        mLastStarsCollected.Add(anim);

        mHUD.StarFill();
    }
Ejemplo n.º 16
0
    protected override Projectile CreateProjectile(int chargeInd, Transform seek)
    {
        Projectile ret = base.CreateProjectile(chargeInd, seek);

        if (ret)
        {
            cannonAnimDat.Play(fireTake);
        }

        return(ret);
    }
Ejemplo n.º 17
0
 void OnTriggerStay(Collider col)
 {
     switch (mCurPhase)
     {
     case Phase.Move:
         if (Time.fixedTime - mLastAttackTime > moveAttackCooldown)
         {
             moveAttackTrigger.SetActive(false);
             mAnimDat.Play(takeAttack);
         }
         break;
     }
 }
Ejemplo n.º 18
0
    protected override void StateChanged()
    {
        base.StateChanged();

        switch ((EntityState)state)
        {
        case EntityState.Normal:
            mIsOpen = false;

            CancelInvoke(orientFunc);
            CancelInvoke(openFunc);

            cannonAnim.Play("normal");

            shellAnimDat.Play("normal");
            stats.isInvul = true;
            Invoke(openFunc, openDelay);

            mDirCur      = Vector3.up;
            mDirAngle    = mDirAngleDest = 0.0f;
            mDirAngleVel = 0.0f;
            break;
        }
    }
Ejemplo n.º 19
0
    void OnBodyJump(PlatformerController ctrl)
    {
        SoundPlayerGlobal.instance.Play("jump");

        if (mBody.jumpCounterCurrent > 1 && !mBody.isJumpWall && !doubleJumpAnim.isPlaying)
        {
            doubleJumpAnim.transform.rotation = mBody.transform.rotation;
            doubleJumpAnim.transform.position = mBody.transform.position;// -mBody.transform.up * mBody.collider.bounds.extents.y;
            doubleJumpAnim.Play("boost");
        }

        mLastMoveVertical   = 0.0f;
        mVerticalMoveActive = false;
        mBody.eyeOfs        = Vector3.zero;
    }
Ejemplo n.º 20
0
    protected override Projectile CreateProjectile(int chargeInd, Transform seek)
    {
        if (mStrikeActives == 0)
        {
            PerformStrike(null, spawnPoint, chargeInd);
            if (mStrikeActives > 0)
            {
                if (fireActiveAnimDat)
                {
                    fireActiveAnimDat.Play("fire");
                }

                currentEnergy -= charges[chargeInd].energyCost;
            }
        }
        return(null);
    }
Ejemplo n.º 21
0
 public void Click(tk2dSpriteAnimator animSpr, AnimatorData toPlay, string take) {
     if(mIsFinalLevel) {
         //if unlocked, load level
     }
     else {
         if(inactive.activeSelf) {
             Main.instance.sceneManager.LoadScene(level);
         }
         else {
             //start intro
             UIModalManager.instance.ModalCloseAll();
             animSpr.Library = animRef;
             LevelSelectCharacterControl.instance.toScene = level;
             LevelSelectCharacterControl.instance.SetAnimWatch(toPlay);
             toPlay.Play(take);
         }
     }
 }
Ejemplo n.º 22
0
    IEnumerator DoStuff()
    {
        WaitForFixedUpdate wait            = new WaitForFixedUpdate();
        WaitForSeconds     shootReadyWait  = new WaitForSeconds(shootReadyDelay);
        WaitForSeconds     shootRepeatWait = new WaitForSeconds(shootRepeatDelay);
        WaitForSeconds     guardWait       = new WaitForSeconds(guardDelay);

        while ((EntityState)state == EntityState.Normal)
        {
            shieldGO.SetActive(true);
            gunGO.SetActive(false);

            yield return(guardWait);

            shieldGO.SetActive(false);
            gunGO.SetActive(true);

            //wait till we are on ground
            while (!bodyCtrl.isGrounded)
            {
                yield return(wait);
            }

            yield return(shootReadyWait);

            for (int i = 0; i < shootCount; i++)
            {
                Vector3 pos = shootPt.position; pos.z = 0.0f;
                Vector3 dir = new Vector3(bodySpriteCtrl.isLeft ? -1.0f : 1.0f, 0.0f, 0.0f);

                shootAnim.Play("shoot");

                Projectile.Create(projGroup, projType, pos, dir, null);

                if (shootSfx)
                {
                    shootSfx.Play();
                }

                yield return(shootRepeatWait);
            }
        }
    }
Ejemplo n.º 23
0
    IEnumerator DoTornado()
    {
        WaitForFixedUpdate wait = new WaitForFixedUpdate();

        //move to a random location
        float destX = RandomX();

        while (MoveTowardsX(destX))
        {
            yield return(wait);
        }

        stats.damageReduction = 1.0f;

        tornadoAnimDat.Play("active");

        bodyCtrl.moveSide = 1.0f;

        float curTime = 0.0f;

        bodyCtrl.lockDragOverrideCount = 1;
        bodyCtrl.rigidbody.drag        = 0;

        tornadoSfx.Play();

        while (curTime < tornadoDuration)
        {
            Vector3 tornadoPos = tornadoAnimDat.transform.position;
            Vector3 pos        = transform.position;
            tornadoPos.x = pos.x;
            tornadoAnimDat.transform.position = tornadoPos;

            bodyCtrl.moveSide = Mathf.Sign(destX - pos.x);

            curTime += Time.fixedDeltaTime;
            yield return(wait);
        }

        ToPhase(Phase.Idle);
    }
Ejemplo n.º 24
0
    IEnumerator DoSeekerFire()
    {
        SpriteHFlipRigidbodyVelX tankSpriteFlip = tank.GetComponent <SpriteHFlipRigidbodyVelX>();

        WaitForFixedUpdate waitUpdate    = new WaitForFixedUpdate();
        WaitForSeconds     waitFireDelay = new WaitForSeconds(seekerFireDelay);

        //prep
        seekerAnimDat.Play("prep");
        do
        {
            yield return(waitUpdate);
        } while(seekerAnimDat.isPlaying);

        //move to a far spot away from player
        Vector3 playerPos = mPlayer.collider.bounds.center;

        float farthestX      = 0;
        float farthestDistSq = 0;

        for (int j = 0; j < movePts.Length; j++)
        {
            Vector3 p = movePts[j].position;
            float   d = Mathf.Abs(playerPos.x - p.x);
            if (d > farthestDistSq)
            {
                farthestDistSq = d;
                farthestX      = p.x;
            }
        }

        //move till we are close
        while (Mathf.Abs(farthestX - collider.bounds.center.x) > 0.1f)
        {
            if (tank.bodyCtrl.moveSide == 0.0f || Mathf.Abs(tank.bodyCtrl.rigidbody.velocity.x) > 2.0f)
            {
                tank.bodyCtrl.moveSide = Mathf.Sign(farthestX - collider.bounds.center.x);
            }
            yield return(waitUpdate);
        }

        tank.bodyCtrl.moveSide           = 0.0f;
        tank.bodyCtrl.rigidbody.velocity = Vector3.zero;

        //fire stuff
        for (int i = 0; i < seekerCount; i++)
        {
            //face player
            float sign = Mathf.Sign(mPlayer.collider.bounds.center.x - collider.bounds.center.x);
            tankSpriteFlip.SetFlip(sign < 0.0f);
            bodySpriteCtrl.isLeft = sign < 0.0f;

            seekerLauncherAnimDat.Play("fire");
            do
            {
                yield return(waitUpdate);
            } while(seekerLauncherAnimDat.isPlaying);

            yield return(waitFireDelay);
        }

        //holster
        seekerAnimDat.Play("holster");
        do
        {
            yield return(waitUpdate);
        } while(seekerAnimDat.isPlaying);

        ToPhase(Phase.Move);
    }
Ejemplo n.º 25
0
    void ToPhase(Phase phase)
    {
        if (mCurPhase == phase)
        {
            return;
        }

        //prev
        switch (mCurPhase)
        {
        case Phase.Move:
            StopCoroutine(moveFireRoutine);
            CancelInvoke(moveToPlayerFunc);
            CancelInvoke(nextPhaseFunc);

            tank.bodyCtrl.moveSide = 0.0f;
            break;

        case Phase.MoveNoTank:
            CancelInvoke(panicShootFunc);
            break;

        case Phase.FireSeeker:
            StopCoroutine(seekerFireRoutine);
            seekerAnimDat.Play("default");
            break;

        case Phase.FireCannon:
            StopCoroutine(cannonFireRoutine);
            break;
        }

        switch (phase)
        {
        case Phase.Move:
            if (tank.bodyCtrl.isGrounded)
            {
                if (!IsInvoking(moveToPlayerFunc))
                {
                    InvokeRepeating(moveToPlayerFunc, 0.0f, moveFacePlayerDelay);
                }
            }
            else
            {
                tank.bodyCtrl.moveSide = 0.0f;     //wait till we land
            }

            Invoke(nextPhaseFunc, moveNextPhaseDelay);
            StartCoroutine(moveFireRoutine);
            break;

        case Phase.FireSeeker:
            StartCoroutine(seekerFireRoutine);
            break;

        case Phase.FireCannon:
            StartCoroutine(cannonFireRoutine);
            break;

        case Phase.MoveNoTank:
            bodySpriteCtrl.StopOverrideClip();

            mMoveToTarget.enabled = false;

            bodyCtrl.rigidbody.isKinematic = false;
            bodyCtrl.enabled          = true;
            bodyCtrl.moveEnabled      = true;
            gravityCtrl.enabled       = true;
            bodySpriteCtrl.controller = bodyCtrl;

            bodySpriteCtrl.moveClip     = cryClip;
            bodySpriteCtrl.idleClip     = cryClip;
            bodySpriteCtrl.upClips[0]   = cryClip;
            bodySpriteCtrl.downClips[0] = cryClip;
            bodySpriteCtrl.RefreshClips();

            mCurMovePtInd = 0;

            mPanicLastJumpTime = 0.0f;

            InvokeRepeating(panicShootFunc, panicFireDelay, panicFireDelay);
            break;

        case Phase.Dead:
            mMoveToTarget.enabled = false;

            bodyCtrl.rigidbody.isKinematic = false;
            bodyCtrl.enabled          = true;
            gravityCtrl.enabled       = true;
            bodySpriteCtrl.controller = bodyCtrl;

            bodyCtrl.moveSide = 0.0f;
            Vector3 vel = bodyCtrl.localVelocity;
            vel.x = 0;
            bodyCtrl.localVelocity = vel;

            bodySpriteCtrl.StopOverrideClip();
            break;
        }

        mCurPhase = phase;
    }
Ejemplo n.º 26
0
    IEnumerator DoMissile()
    {
        WaitForFixedUpdate wait = new WaitForFixedUpdate();

        do
        {
            yield return(wait);
        } while(!bodyCtrl.isGrounded);

        FacePlayer();

        //jump
        Jump(0.3f);


        //wait till we are about to drop
        while (bodyCtrl.isGrounded || bodyCtrl.isJump || bodyCtrl.localVelocity.y > -0.1f)
        {
            yield return(wait);
        }

        SetPhysicsActive(false, false);

        //warp-out
        teleOutSfx.Play();

        mAnimDat.Play(takeWarpOut);
        while (mAnimDat.isPlaying)
        {
            yield return(wait);
        }

        //launch
        seekerSfx.Play();

        Vector3 missilePt = collider.bounds.center; missilePt.z = 0;

        for (int i = 0; i < mMissiles.Length; i++)
        {
            mMissiles[i] = Projectile.Create(projGroup, missileProj, missilePt, Vector3.zero, null) as ProjectileTweenTo;

            //move missile to start pos.
            mMissiles[i].Move(missilePts[i].position, missileStartSpeed);
        }

        while (true)
        {
            int numDone = 0;
            for (int i = 0; i < mMissiles.Length; i++)
            {
                if (!mMissiles[i].isMoveActive)
                {
                    numDone++;
                }
            }
            if (numDone == mMissiles.Length)
            {
                break;
            }

            yield return(wait);
        }
        //

        yield return(new WaitForSeconds(missileMoveStartDelay));

        M8.ArrayUtil.Shuffle(mMissiles);

        WaitForSeconds missileMoveWait = new WaitForSeconds(missileMoveDelay);

        //move towards player
        for (int i = 0; i < mMissiles.Length; i++)
        {
            Vector2 ofs          = Random.insideUnitCircle;
            Vector3 toPos        = mPlayer.collider.bounds.center;
            Vector3 playerVel    = mPlayer.controller.localVelocity;
            Vector3 playerVelDir = playerVel.normalized;

            if (Mathf.Abs(playerVel.x) >= missilePlayerAheadMin.x)
            {
                toPos.x += playerVelDir.x * missilePlayerAhead.x;
            }
            if (Mathf.Abs(playerVel.y) >= missilePlayerAheadMin.y)
            {
                toPos.y += playerVelDir.y * missilePlayerAhead.y;
            }

            toPos.x += ofs.x * missilePlayerRadius;
            toPos.y += ofs.y * missilePlayerRadius;
            toPos.z  = 0.0f;

            mMissiles[i].Move(toPos, missileMoveSpeed);
            seekerSfx.Play();
            yield return(missileMoveWait);
        }

        while (true)
        {
            int numDone = 0;
            for (int i = 0; i < mMissiles.Length; i++)
            {
                if (!mMissiles[i].isMoveActive)
                {
                    numDone++;
                }
            }
            if (numDone == mMissiles.Length)
            {
                break;
            }

            yield return(wait);
        }
        //

        //determine warp pos.
        transform.position = teleports[mCurTeleportInd].position;
        mCurTeleportInd++; if (mCurTeleportInd == teleports.Length)
        {
            mCurTeleportInd = 0;
        }

        //move missiles to new pos.
        for (int i = 0; i < mMissiles.Length; i++)
        {
            mMissiles[i].Move(missilePts[i].position, missileMoveSpeed);
            seekerSfx.Play();
            yield return(missileMoveWait);
        }

        while (true)
        {
            int numDone = 0;
            for (int i = 0; i < mMissiles.Length; i++)
            {
                if (!mMissiles[i].isMoveActive)
                {
                    numDone++;
                }
            }
            if (numDone == mMissiles.Length)
            {
                break;
            }

            yield return(wait);
        }
        //

        //warp-in
        teleInSfx.Play();

        mAnimDat.Play(takeWarpIn);
        while (mAnimDat.isPlaying)
        {
            yield return(wait);
        }

        ToPhase(Phase.Idle);
    }
Ejemplo n.º 27
0
 public void PopUpMessage(string text)
 {
     mPopUpMessageLabel.text = text;
     popUpMessage.Play("go");
 }
Ejemplo n.º 28
0
 public void Fill()
 {
     mSprite.spriteName = fillRef;
     mAnim.Play("collect");
 }
Ejemplo n.º 29
0
 void DoPlay()
 {
     animDat.Play(take);
 }
Ejemplo n.º 30
0
    void FixedUpdate()
    {
        switch ((EntityState)state)
        {
        case EntityState.Normal:
            float     distSqr;
            Transform nearest = NearestPlayer(out distSqr);

            if (bodyCtrl.isGrounded)
            {
                bodySpriteCtrl.isLeft = Mathf.Sign(nearest.position.x - transform.position.x) < 0.0f;

                if (!mJump && !bodyCtrl.isJump)
                {
                    if (Time.fixedTime - mLastJumpTime > jumpRepeatDelay)
                    {
                        Jump(0);
                        Jump(2.0f);
                        mJump = true;

                        if (jumpTowardsPlayer)
                        {
                            bodyCtrl.moveSide = bodySpriteCtrl.isLeft ? -1.0f : 1.0f;
                        }
                    }
                }
            }
            else
            {
                if (nearest && nearest.position.y < transform.position.y && Time.fixedTime - bodyCtrl.jumpLastTime > 0.15f)
                {
                    Jump(0);
                }
            }

            if (nearest)
            {
                if (!mProjIsShot && mCurProjCount < shootMaxProj)
                {
                    if (!bodyCtrl.isGrounded && bodyCtrl.localVelocity.y <= shootVelYMax)
                    {
                        Vector3 pos = shootPt.position; pos.z = 0.0f;

                        Vector3 dir = new Vector3(bodySpriteCtrl.isLeft ? -1.0f : 1.0f, 0.0f, 0.0f);

                        if (shootCount > 1)
                        {
                            Quaternion rot = Quaternion.AngleAxis(shootAngle / ((float)(shootCount - 1)), bodySpriteCtrl.isLeft ? Vector3.back : Vector3.forward);
                            dir = Quaternion.AngleAxis(shootAngle * 0.5f, bodySpriteCtrl.isLeft ? Vector3.forward : Vector3.back) * dir;

                            for (int i = 0; i < shootCount; i++)
                            {
                                mCurProjCount++;
                                Projectile proj = Projectile.Create(projGroup, projType, pos, dir, null);
                                proj.releaseCallback += OnProjRelease;

                                dir = rot * dir;
                            }
                        }
                        else
                        {
                            mCurProjCount++;
                            Projectile proj = Projectile.Create(projGroup, projType, pos, dir, null);
                            proj.releaseCallback += OnProjRelease;
                        }

                        if (shootAnim)
                        {
                            shootAnim.Play("shoot");
                        }

                        if (shootSfx)
                        {
                            shootSfx.Play();
                        }

                        mProjIsShot = true;
                    }
                }

                //bodySpriteCtrl.isLeft = Mathf.Sign(nearest.position.x - transform.position.x) < 0.0f;
            }
            break;
        }
    }
Ejemplo n.º 31
0
 public void ResetState()
 {
     mAnim.Play("default");
     collider.enabled = true;
 }