示例#1
0
    // Update is called once per frame
    void Update()
    {
        // This should go in Start, but I'm not sure playerNumber
        // will be assigned in time.
        if (playerNumber == -1)
        {
            return;
        }
        else if (playerInput == null)
        {
            playerInput = PlayerInput.GetInputReceiver(playerNumber);
        }

        if (!GlobalGameData.playersIn[playerNumber])
        {
            image.localScale = Vector3.one * (0.75f + (Mathf.Sin(Time.time * 2.0f) * 0.25f));

            if (playerInput.aDown)
            {
                GlobalGameData.playersIn[playerNumber] = true;
                image.gameObject.SetActive(false);
                toon.gameObject.SetActive(true);
                toon.playASound();
            }
        }
        else
        {
            if (playerInput.aDown)
            {
                GlobalGameData.playersIn[playerNumber] = false;
                image.gameObject.SetActive(true);
                toon.gameObject.SetActive(false);
            }
        }
    }
示例#2
0
 // Start is called before the first frame update
 void Start()
 {
     damagedTile = null;
     pab         = transform.parent.GetComponent <PlayersAssemblyBehavior>();
     damageGrid  = transform.parent.parent.GetComponentInChildren <DamageGridBehavior>();
     playerInput = PlayerInput.GetInputReceiver(pab.GetPlayerIndex(transform));
 }
示例#3
0
    // Start is called before the first frame update
    void Start()
    {
        body  = GetComponent <Rigidbody2D>();
        p     = GetComponentInParent <PlayersAssemblyBehavior>();
        input = PlayerInput.GetInputReceiver(p.GetPlayerIndex(transform));

        anim = GetComponent <Animator>();
    }