void Awake() { animator = GetComponent <Animator>(); rbody = GetComponentInParent <Rigidbody>(); physics = GetComponentInParent <PlayerPhysics>(); attackbehaviour = GetComponentInParent <AttackBehaviour>(); deadbehaviour = GetComponentInParent <DeadBehaviour>(); rotationY = Quaternion.Euler(0, 90, 0); }
public static void DeathPhysics(this GameObject go, Entity entity, DeadBehaviour deadBehaviour) { if (deadBehaviour.RemoveTag) { go.tag = String.Empty; } if (deadBehaviour.RemoveRigidbody) { go.GetComponents <Rigidbody>().ForEach(a => UnityEngine.Object.Destroy(a)); } if (deadBehaviour.RemoveColliders) { go.GetComponentsInChildren <Collider>().ForEach(a => UnityEngine.Object.Destroy(a)); } }
void Awake() { physics = GetComponent <PlayerPhysics>(); controller = GetComponent <PlayerController>(); grapplingGun = GetComponent <GrapplingGun>(); attackbehaviour = GetComponent <AttackBehaviour>(); deadbehaviour = GetComponent <DeadBehaviour>(); physics.player = this; controller.physics = physics; controller.grapplingGun = grapplingGun; controller.attackBehaviour = attackbehaviour; controller.deadbehaviour = deadbehaviour; grapplingGun.physics = physics; attackbehaviour.physics = physics; }