public float GetBasePosition(playerposition position, bool team) { float newposition = 0.0f; switch (position) { case playerposition.GK: if (team) { newposition = 13; } else { newposition = 26; } break; case playerposition.DF: if (team) { newposition = 16; } else { newposition = 23; } break; case playerposition.MF: newposition = 20; break; case playerposition.ST: if (team) { newposition = 23; } else { newposition = 16; } break; } if (m_Ball.m_CurrentTeam == team) { if (team) { newposition += m_AttackDistance; } else { newposition -= m_AttackDistance; } } return(newposition); }
public void SetData(Transform goal, List <Unit> team, bool myteam, playerposition position) { name = "AI - " + Random.Range(0, 555); m_PlayerPosition = position; m_UnitTeam = myteam; m_Goal = goal; m_TeamMates = team; m_MainBasePosition = m_Manager.GetBasePosition(m_PlayerPosition, myteam); }
void OnTriggerEnter(Collider other) { if (other.gameObject.tag == "Player") { SceneManager.LoadScene(targetLevelName); Scene s = SceneManager.GetSceneByName(targetLevelName); playerposition pos = GameObject.FindGameObjectWithTag("PlayerPosition").GetComponent <playerposition> (); pos.spawn = new Vector3(other.transform.position.x + 32.36f, other.transform.position.y - 5.44f, other.transform.position.z + 154.97f); pos.rotation = new Vector3(other.transform.localEulerAngles.x, other.transform.localEulerAngles.y, other.transform.localEulerAngles.z); SceneManager.SetActiveScene(s); } }