Example #1
0
    // Update is called once per frame
    void Update()
    {
        if (CrossPlatformInputManager.GetButtonDown("Fire"))
        {
            GamerController mainGameController = GetGameController();
            int             currentPlayerIndex = mainGameController.GetCurrentPlayerIndex();

            CharacterObject currentObject = mainGameController.GetCharacterProperties(currentPlayerIndex);

            // Fire only when both are originating from the same object
            if (canFireCheck(currentObject) && currentObject.weaponName != "Grenade")
            {
                currentObject.charActions.Attack();
                Shoot(mainGameController, currentObject, currentPlayerIndex, (currentPlayerIndex + 1) % 2);
            }
        }
    }