// Start is called before the first frame update void Start() { character = transform.Find("Character"); myRigidbody = character.GetComponent <Rigidbody>(); playerTouch = character.GetComponent <PlayerTouch>(); animator = character.GetComponent <Animator>(); if (speed <= 0) { speed = 1f; } if (jumpForce <= 0) { jumpForce = 8f; } if (jumpTime <= 0) { jumpTime = 0.3f; } // Yet another small change timer = jumpTime + 1; alive = true; playerTouch.OffTheGround.AddListener(JumpStartForce); //playerTouch.DeathTouch.AddListener(Death); -> relegated to Game Manager playerTouch.StandUpAnimationEnd.AddListener(RegainMovement); playerTouch.PunchAnimationEnd.AddListener(RegainPunch); Transform gndTrigger = character.Find("GndTrigger"); gndDetector = gndTrigger.GetComponent <GroundDetector>(); gndDetector.BackToGround.AddListener(BackFromJump); Transform bdyTrigger = character.Find("BdyTrigger"); bdyDetector = bdyTrigger.GetComponent <BodyDetector>(); bdyDetector.NearSwitch.AddListener(NearSwitch); bdyDetector.AwayFromSwitch.AddListener(AwayFromSwitch); bdyDetector.EnterSunlight.AddListener(ActivateSunlight); //bdyDetector.LeaveSunlight.AddListener(DeactivateSunlight); Transform fntTrigger = character.Find("FntTrigger"); fntDetector = fntTrigger.GetComponent <FrontDetector>(); fntDetector.EnterPushable.AddListener(() => { /*Debug.Log("Can Push");*/ pushing = true; }); fntDetector.LeavePushable.AddListener(() => { /*Debug.Log("Cannot Push");*/ pushing = false; }); }
void Start() { //References input = GetComponent <PlayerInput>(); movement = GetComponent <PlayerMovement>(); groundDetector = GetComponentInChildren <GroundDetector>(); ceilingDetector = GetComponentInChildren <CeilingDetector>(); wallrunDetector = GetComponentInChildren <WallrunDetector>(); frontDetector = GetComponentInChildren <FrontDetector>(); coll = GetComponent <CapsuleCollider>(); rb = GetComponent <Rigidbody>(); camController = GetComponent <CameraController>(); cam = Camera.main; status = Status.walking; InitialAbilityCharge(); }