Beispiel #1
0
    void OnClickLane(GameObject target)
    {
        Slot selectedLane = target.FindComponentUpwards<Slot>();

        if (selectedUnitPoolSlot != null && !selectedUnitPoolSlot.IsFree && selectedLane != null && selectedLane.IsFree)
        {
            if (Time.time - selectedLane.LastAddTime > SlotAddTimeout)
            {
                var unit = selectedUnitPoolSlot.Unit;
                selectedUnitPoolSlot.Unit = null;
                selectedUnitPoolSlot = null;
                selectedLane.LastAddTime = Time.time;
                unit.transform.position = selectedLane.transform.position;
                unit.gameObject.AddComponent<UnitMovement>().Velocity = SpawnVelocity;
                unit.transform.rotation = Quaternion.Euler(SpawnRotation);
                unit.PlayerId = Id;
                unit.BroadcastMessage("StopBlinking");
                AudioController.Instance.PlaySound("click");

                UpdateBlinking();
            }
        }
    }
Beispiel #2
0
 void OnClickPoolSlot(GameObject target)
 {
     //Debug.Log("OnClickPoolSlot", gameObject);
     selectedUnitPoolSlot = target.FindComponentUpwards<Slot>();
     AudioController.Instance.PlaySound("click");
 }