Example #1
0
    void Awake()
    {
        mPlayer = GetComponent <Player>();
        mPlayer.spawnCallback    += OnPlayerSpawn;
        mPlayer.setStateCallback += OnPlayerSetState;
        mPlayer.setBlinkCallback += OnPlayerBlink;

        mBody = GetComponentInChildren <PlatformerController>();

        mBody.player     = 0;
        mBody.moveInputX = InputAction.MoveX;
        mBody.moveInputY = InputAction.MoveY;
        mBody.jumpInput  = InputAction.Jump;

        mBody.jumpCallback          += OnBodyJump;
        mBody.collisionStayCallback += OnBodyCollisionStay;
        mBody.triggerEnterCallback  += OnBodyTriggerEnter;

        mBodySpriteCtrl = mBody.GetComponent <PlatformerSpriteController>();
        mBodySpriteCtrl.flipCallback            += OnFlipCallback;
        mBodySpriteCtrl.anim.AnimationCompleted += OnBodySpriteAnimFinish;

        mBombCtrl = bomb.GetComponent <BombController>();
        mBombCtrl.deathCallback += OnBombDeathCallback;

        mTargetGO = GameObject.FindGameObjectWithTag("Goal");
    }