Exemple #1
0
    /// <summary>
    /// Unity Function. Called once the MonoBehaviour's game object is instantiated.
    /// </summary>
    void Awake()
    {
        tag = "Player";

        // Order is important
        this.rigidBody2d    = GetComponent <Rigidbody2D> ();
        this.collider2d     = GetComponent <Collider2D> ();
        this.playerAnimator = GetComponent <Animator> ();
        this.playerHealth   = GetComponent <PlayerHealth> ();
        this.playerAttack   = GetComponent <PlayerAttack> ();
        this.playerGem      = GetComponent <PlayerGem> ();
        this.playerLift     = GetComponent <PlayerLift> ();

        this.groundLayerMask = LayerMask.NameToLayer("Ground");
        this.playerMovement  = new PlayerMovement(this);  //GetComponent<PlayerMovement> ();
        this.playerInput     = new PlayerInput(this);     //GetComponent<PlayerInput> ();
        this.DropGemItem();
        this.DropLiftItem();


        EventBroadcaster.Instance.AddObserver(EventNames.ACQUIRE_ALL, AcquireAll);
        EventBroadcaster.Instance.AddObserver(EventNames.RETRY, DropDead);
        EventBroadcaster.Instance.AddObserver(EventNames.RINGLEADER_DEATH, LastWords);
        // To set proper buttons
        //		GameController_v7.Instance.GetMobileUIManager().ToggleBaseWithPickupControls(true);
    }
Exemple #2
0
 /// <summary>
 /// Getter for the Player Lift functionality.
 /// </summary>
 /// <returns></returns>
 public PlayerLift GetPlayerLift()
 {
     if (this.playerLift == null)
     {
         this.playerLift = GetComponentInChildren <PlayerLift> ();
     }
     return(this.playerLift);
 }