Пример #1
0
 void Start()
 {
     leftButtonIconMovement  = leftButton.GetComponentInChildren <ButtonIconMovement>();
     leftButtonIcon          = leftButtonIconMovement.gameObject.GetComponent <RectTransform>();
     rightButtonIconMovement = rightButton.GetComponentInChildren <ButtonIconMovement>();
     rightButtonIcon         = rightButtonIconMovement.gameObject.GetComponent <RectTransform>();
     loadButtonIconMovement  = loadButton.GetComponentInChildren <ButtonIconMovement>();
     loadButtonIcon          = loadButtonIconMovement.gameObject.GetComponent <RectTransform>();
     shootButtonIconMovement = shootButton.GetComponentInChildren <ButtonIconMovement>();
     shootButtonIcon         = shootButtonIconMovement.gameObject.GetComponent <RectTransform>();
     StartCoroutine(AILoop());
 }
Пример #2
0
    void Start()
    {
        bottomCpuIconMovement = bottomPlayerButtons[bottomPlayerButtons.Length - 1].GetComponentInChildren <ButtonIconMovement>();
        bottomCpuIcon         = bottomCpuIconMovement.gameObject.GetComponent <RectTransform>();
        upperCpuIconMovement  = upperPlayerButtons[upperPlayerButtons.Length - 1].GetComponentInChildren <ButtonIconMovement>();
        upperCpuIcon          = upperCpuIconMovement.gameObject.GetComponent <RectTransform>();

        if (!colorHasBeenAssigned)
        {
            colorHasBeenAssigned = true;
            SetBottomPlayerColor(Random.Range(0, System.Enum.GetNames(typeof(PlayerColor)).Length - 1));
            SetUpperPlayerColor(Random.Range(0, System.Enum.GetNames(typeof(PlayerColor)).Length - 1));
        }
        else
        {
            SetBottomPlayerColor((int)bottomPlayerColor);
            SetUpperPlayerColor((int)upperPlayerColor);
        }

        if (upperPlayerColor == PlayerColor.CPU)
        {
            upperCpuIcon.localPosition = Vector2.zero;
        }
        else
        {
            upperCpuIcon.localPosition = upperCpuIconMovement.nonPressedPosition;
        }

        if (bottomPlayerColor == PlayerColor.CPU)
        {
            bottomCpuIcon.localPosition = Vector2.zero;
        }
        else
        {
            bottomCpuIcon.localPosition = bottomCpuIconMovement.nonPressedPosition;
        }
    }
Пример #3
0
 void Start()
 {
     shootButtonIconMovement = shootButton.GetComponentInChildren <ButtonIconMovement>();
     shootButtonIcon         = shootButtonIconMovement.gameObject.GetComponent <RectTransform>();
 }