public override void InitializeAgent() { base.InitializeAgent(); wallDetect = GetComponent <WallDetect>(); wallDetect.agent = this; rayPer = GetComponent <RayPerception>(); }
// Start is called before the first frame update void Awake() { Player = this; psm = new Dictionary <PlayerStates, Action> { { PlayerStates.IDLE, HandleIdle }, { PlayerStates.RUN, HandleRun }, { PlayerStates.BOOM_JUMP, HandleBoomJump }, { PlayerStates.IN_AIR, HandleInAir }, { PlayerStates.WALL_GRAB, HandleWallGrab }, { PlayerStates.BOOM_DEAD, HandleDead }, { PlayerStates.SPIKE_DEAD, HandleDead }, { PlayerStates.SUCCESS, HandleSuccess } }; // Set players' starting state. SetState(PlayerStates.IDLE); animStates = new Dictionary <PlayerStates, string>() { { PlayerStates.IDLE, idleAnim }, { PlayerStates.RUN, runAnim }, { PlayerStates.BOOM_JUMP, bjAnim }, { PlayerStates.IN_AIR, inAirAnim }, { PlayerStates.WALL_GRAB, wallGrabAnim }, { PlayerStates.SPIKE_DEAD, spikeDeadAnim }, { PlayerStates.BOOM_DEAD, boomDeadAnim }, { PlayerStates.SUCCESS, victoryAnim } }; RB = GetComponent <Rigidbody2D>(); PlayerSpriteRenderer = GetComponent <SpriteRenderer>(); MainCollider = GetComponent <CapsuleCollider2D>(); PlayerAnimator = GetComponent <Animator>(); ExplosionAnimator = transform.GetChild(0).GetComponent <Animator>(); ExplosionCollider = transform.GetChild(0).GetComponent <CapsuleCollider2D>(); BoomJumpSource = ExplosionAnimator.GetComponent <AudioSource>(); wDetector = transform.GetChild(1).GetComponent <WallDetect>(); if (!MainCollider.enabled) { MainCollider.enabled = true; } // Set the players starting current health. if (curPlayerHealth != maxPlayerHealth) { curPlayerHealth = maxPlayerHealth; } bombCoolDownTimer = bombCoolDownTime; // When player starts, they are disabled. After pressing any key for Intro Quip, reenable the player script component. enabled = false; }