Пример #1
0
    public void Bumped(Player bumpee, Vector2 collisionVector)
    {
        //Invoke Unity Events
        if (SceneManager.GetActiveScene().name == "Init Scene")
        {
            if (bumpee.playerNumber.ToString() == "1")
            {
                StartCoroutine(WaitBeforeEvents());
            }
        }
        else if (SceneManager.GetActiveScene().name == "WinScreen")
        {
            StockCanvas stockCanvas = GameObject.FindGameObjectWithTag("StockCanvas").GetComponent <StockCanvas>();
            stockCanvas.SelfDestruct();

            GameObject player = GameObject.FindGameObjectWithTag("Player");
            Destroy(player);
            manager.GetComponent <Manager>().sceneLoader.LoadScene("Init Scene");
        }
        else
        {
            StartCoroutine(WaitBeforeEvents());
        }

        if (abilitySelection && bumpee.stockCount > 1)
        {
            if (canGetAbility)
            {
                canGetAbility = false;
                bumpee.LooseStock();
                UpdatePlayersAlive();

                switch (abilityType)
                {
                case 0:
                    bumpee.ChangeAAbility(newAAbility);
                    break;

                case 1:
                    bumpee.ChangeXAbility(newXAbility);
                    break;

                case 2:
                    bumpee.ChangeYAbility(newYAbility);
                    break;

                case 3:
                    bumpee.ChangeBAbility(newBAbility);
                    break;

                default:
                    break;
                }

                StartCoroutine(SelfDestruct());
            }
        }

        BumpEffect(bumpee, collisionVector);
    }
Пример #2
0
    private void Awake()
    {
        stockCanvas = FindObjectOfType <StockCanvas>();


        var plrs = FindObjectsOfType <Player>();



        for (int i = 0; i < plrs.Length; i++)
        {
            Destroy(plrs[i].gameObject);
        }

        stick1 = $"Joystick{1}Button7";
        kc1    = (KeyCode)System.Enum.Parse(typeof(KeyCode), stick1);
        pla1   = true;

        stick2 = $"Joystick{2}Button7";
        kc2    = (KeyCode)System.Enum.Parse(typeof(KeyCode), stick2);
        pla2   = true;

        stick3 = $"Joystick{3}Button7";
        kc3    = (KeyCode)System.Enum.Parse(typeof(KeyCode), stick3);
        pla3   = true;

        stick4 = $"Joystick{4}Button7";
        kc4    = (KeyCode)System.Enum.Parse(typeof(KeyCode), stick4);
        pla4   = true;

        plaDebug = true;
    }
Пример #3
0
    private void Awake()
    {
        if (!instance)
        {
            instance = this;
        }

        if (instance != this)
        {
            Destroy(this.gameObject);
        }

        DontDestroyOnLoad(gameObject);
    }
Пример #4
0
    private void Awake()
    {
        //Ref:
        rb          = GetComponent <Rigidbody2D>();
        anim        = gameObject.GetComponentInChildren <Animator>();
        rend        = GetComponentInChildren <SpriteRenderer>();
        textMesh    = GetComponent <TextMeshPro>();
        stockCanvas = GameObject.FindGameObjectWithTag("StockCanvas").GetComponent <StockCanvas>();

        //Dont Destroy:
        DontDestroyOnLoad(gameObject);

        bAbility = Manager.WorldOptions.bDefault;
        aAbility = Manager.WorldOptions.aDefault;
        xAbility = Manager.WorldOptions.xDefault;
        yAbility = Manager.WorldOptions.yDefault;
    }
Пример #5
0
 private void Start()
 {
     stockCanvas = GameObject.FindGameObjectWithTag("StockCanvas").GetComponent <StockCanvas>();
     manager     = GameObject.FindGameObjectWithTag("Manage");
 }