private void Start() { DontDestroyOnLoad(this); _rigidbody = GetComponent<Rigidbody2D>(); _animator = GetComponent<Animator>(); _jumpChecker = GetComponent<JumpChecker>(); }
// Start is called before the first frame update void Start() { rb = GetComponent <Rigidbody2D>(); spriteRenderer = GetComponent <SpriteRenderer>(); foreach (JumpChecker checker in GetComponentsInChildren <JumpChecker>()) { switch (checker.type) { case JumpCheckerType.Ground: ground_checker = checker; break; case JumpCheckerType.LeftWall: l_wall_checker = checker; break; case JumpCheckerType.RightWall: r_wall_checker = checker; break; default: break; } } ground_checker.GroundEvent += OnGround; l_wall_checker.GroundEvent += OnGround; r_wall_checker.GroundEvent += OnGround; anim = GetComponent <Animator>(); jump_hash = Animator.StringToHash("Jump"); air_hash = Animator.StringToHash("Air"); speed_hash = Animator.StringToHash("Speed"); wall_hash = Animator.StringToHash("Wall"); hurt_hash = Animator.StringToHash("Hurt"); }
// Use this for initialization void Start() { JumpChecker.instanceJC = this; Physics.IgnoreCollision(playerColl.GetComponent <CapsuleCollider>(), GetComponent <CapsuleCollider>()); }