/// <summary> /// This function is called on the first frame the object is spawned /// it stores references to this objects Transform and PawnAABB classes /// grabs the first object in the scene to have a PlayerController script (since only the player should have a PlayerController script) /// it then gets the transform of the player object and stores it in a variable for later use /// </summary> void Start() { enemy = gameObject.GetComponent <Transform>(); enemyBoxCollider = gameObject.GetComponent <BoxCollider>(); Player.PlayerController playerControl = (Player.PlayerController)FindObjectOfType(typeof(Player.PlayerController)); player = playerControl.GetComponent <Transform>(); if (useActivationDistance == false) { isActivated = true; } }
// Use this for initialization void Start() { m_Animator = GetComponent <Animator>(); m_PlayerMovement = m_PlayerController.GetComponent <Player_Movement>(); m_PlayerController.OnDeath.AddListener(HandleDeath); //// Find target bone //m_HeadBone = TargetArmature.transform; //Transform tr = m_HeadBone.FindChild(TargetBone); ; //if (tr != null) // m_HeadBone = tr; SetColor(m_PlayerController.PlayerColor); }
/// <summary> /// This method is called to attach the raft to a player. /// </summary> /// <param name="player">The PlayerController to attach to.</param> public void Attach(Player.PlayerController player) { pawn = player; transform.rotation = player.GetComponent <Transform>().rotation; }