// MonoBehaviour's interface void Awake() { // Cache components. { m_CharacterController = GetComponent <tnCharacterController>(); m_CharacterInput = GetComponent <tnCharacterInput>(); m_StatsContainer = GetComponent <tnStatsContainer>(); m_Energy = GetComponent <tnEnergy>(); m_Respawn = GetComponent <tnRespawn>(); } // Force values refresh. { ComputeRadius(FP.Zero); ComputeEnergyCost(FP.Zero); ComputeCooldown(FP.Zero); ComputeKickForce(FP.Zero); ComputeTackleForce(FP.Zero); } // Compute charging layer. m_ChargingLayer = LayerMask.NameToLayer("Charging"); // Set sort order. sortOrder = BehaviourSortOrder.s_SortOrder_Kick; }
// MonoBehaviour's interface private void Awake() { DontDestroyOnLoad(gameObject); if (m_CharacterStandardPrefab != null) { m_CharacterControllerComponent = m_CharacterStandardPrefab.GetComponent <tnCharacterController>(); m_KickComponent = m_CharacterStandardPrefab.GetComponent <tnKick>(); } }
// MonoBehaviour's INTERFACE void Awake() { m_CharacterController = GetComponent <tnCharacterController>(); m_Respawn = GetComponent <tnRespawn>(); m_Kick = GetComponent <tnKick>(); m_Kickable = GetComponent <tnKickable>(); m_AttractContoller = GetComponent <tnAttract>(); // Set sort order. sortOrder = BehaviourSortOrder.s_SortOrder_CharacterStats; }
// TSColliderEffector2D's interface protected override bool OnValidateGameObject(GameObject i_GameObject) { bool valid = !Layer.IsGameObjectInLayerMask(i_GameObject, m_ExcludeLayerMask); tnCharacterController characterController = i_GameObject.GetComponent <tnCharacterController>(); if (characterController != null) { int currentLayer = characterController.currentLayer; valid = !Layer.IsLayerInMask(currentLayer, m_ExcludeLayerMask); } return(valid); }
private void SetPlayerBehavioursEnabled(bool i_Enabled) { for (int index = 0; index < charactersCount; ++index) { GameObject character = GetCharacterByIndex(index); if (character == null) { continue; } tnCharacterController characterController = character.GetComponent <tnCharacterController>(); if (characterController != null) { characterController.runSyncedUpdate = i_Enabled; } tnKick kick = character.GetComponent <tnKick>(); if (kick != null) { kick.runSyncedUpdate = i_Enabled; } tnAttract attract = character.GetComponent <tnAttract>(); if (attract != null) { attract.runSyncedUpdate = i_Enabled; } tnTaunt taunt = character.GetComponent <tnTaunt>(); if (taunt != null) { taunt.runSyncedUpdate = i_Enabled; } tnSubbuteoController subbuteoController = character.GetComponent <tnSubbuteoController>(); if (subbuteoController != null) { subbuteoController.runSyncedUpdate = i_Enabled; } } }
public override void OnInspectorGUI() { base.OnInspectorGUI(); if (EditorApplication.isPlaying) { tnCharacterController characterController = target as tnCharacterController; if (characterController == null) { return; } TSRigidBody2D rigidbody = characterController.GetComponent <TSRigidBody2D>(); TSVector2 velocity = (rigidbody != null) ? rigidbody.velocity : TSVector2.zero; FP speed = velocity.magnitude; EditorGUILayout.Space(); EditorGUILayout.LabelField("Speed: " + speed.ToString(2), EditorStyles.label); } }