void Start() { m_SpeedMultiplier = 1.0f; m_IsMoving = true; m_PlayerMovement = GameMaster.Instance.m_PlayerMovement; m_PlayerStats = GameMaster.Instance.m_PlayerStats; CircleCollider2D playerCircleCollider = m_PlayerMovement.GetComponent <CircleCollider2D>(); if (playerCircleCollider != null) { m_PlayerColliderRadius = playerCircleCollider.radius; } // Cap base speed if (m_BaseSpeed > m_MaxSpeed) { m_BaseSpeed = m_MaxSpeed; } }
public void ForceSwitchToMC() { if (mc.isActiveAndEnabled) { obtainedNPC = false; } else { obtainedNPC = false; mc.enabled = true; mcIsFollowing = false; npc.enabled = false; currentPlayer = mc.transform; npc.GetComponent <PlayerMovement>().StopAnimation(); // npc.GetComponent<CharacterController2D>().QueueDisableColliders(); mc.GetComponent <CharacterController2D>().EnableColliders(); playerMentalHealth.SwitchTarget(mc.gameObject); mainCamera.switchTarget(mc); } }
// Use this for initialization void Start() { playerObj = FindObjectOfType <PlayerMovement>(); playerAnim = playerObj.GetComponent <Animator>(); }