private void SetPlayerPos() { if (engine.CurrentHP > 0) { if (Ai.CurrentSlot.playerIndex >= 0 && Ai.CurrentSlot.playerIndex <= AiSlotMachine.Instace.slots) { NexusCrowdManager.Instance.SetSlotFree(Ai.CurrentSlot.nexusIndex); AiSlotMachine.Instace.SetSlotFree(Ai.CurrentSlot.playerIndex); Ai.CurrentSlot = AiSlotMachine.Instace.RequestSlot(Ai.transform.position); } else { NexusCrowdManager.Instance.SetSlotFree(Ai.CurrentSlot.nexusIndex); //AiSlotMachine.Instace.SetSlotFree(Ai.CurrentSlot.playerIndex); NpcSlot temp = AiSlotMachine.Instace.RequestSlot(Ai.transform.position); if (temp.playerIndex == -1) { SetNexusPos(); } else { Ai.CurrentSlot = temp; goingForNexus = false; } } } else { SetNexusPos(); } }
private NpcSlot[] CreatePoints(float _Radius, int _Slots) { List <NpcSlot> listPoints = new List <NpcSlot>(); float x = 0; float y = 0; float z = 0; float angle = 20f; for (int i = 0; i < _Slots; i++) { x = Mathf.Sin(Mathf.Deg2Rad * angle) * _Radius; z = Mathf.Cos(Mathf.Deg2Rad * angle) * _Radius; NpcSlot temp = new NpcSlot(); temp.localPos = new Vector3(x, y, z); temp.taken = false; temp.nexusIndex = i; temp.partent = transform; listPoints.Add(temp); angle += (360f / _Slots); } return(listPoints.ToArray()); }
public void Setup(Vector3 startPos) { CurrentSlot = Nexus.RequestSlot(startPos); Agent.enabled = true; Hp = MaxHp; Agent.Warp(startPos); Machine.TransitionTo <AiWalking>(); }
private void Start() { aiSlots = new NpcSlot[slots]; angleDepth = 360f / slots; for (int i = 0; i < slots; i++) { Vector3 tempLocalSpot = Quaternion.Euler(0f, angleDepth * i, 0f) * (Vector3.forward * radius); aiSlots[i] = new NpcSlot { localPos = tempLocalSpot, taken = false, playerIndex = i, partent = transform }; } }