Exemple #1
0
    private void Start()
    {
        schemeGetter = GameObject.FindGameObjectWithTag("SchemeGetter").GetComponent <GetScheme>();

        Physics2D.IgnoreCollision(GameObject.FindGameObjectWithTag("Canoe").GetComponent <BoxCollider2D>(), GetComponent <Collider2D>(), true);
        Physics2D.IgnoreCollision(GameObject.FindGameObjectWithTag("River").GetComponent <Collider2D>(), GetComponent <Collider2D>(), true);
        //if (GetComponent<Collider2D>())
        //{
        //    Physics2D.IgnoreCollision(GameObject.FindGameObjectWithTag("River").GetComponent<Collider2D>(), GetComponent<Collider2D>(), true);
        //    Physics2D.IgnoreCollision(GameObject.FindGameObjectWithTag("Canoe").GetComponent<BoxCollider2D>(), GetComponent<Collider2D>(), true);
        //}
        source.PlayOneShot(shoot);
        schemeGetter.AddSoundText("Pow!");
    }
    private void Awake()
    {
        mainMenu = GameObject.FindGameObjectWithTag("MainMenu");
        string nameScene = SceneManager.GetActiveScene().name;

        if (nameScene == "Game_0")
        {
            mainMenu.SetActive(false);
        }
        infoMenu     = GameObject.FindGameObjectWithTag("InfoMenu");
        schemeGetter = GameObject.FindGameObjectWithTag("SchemeGetter").GetComponent <GetScheme>();
        // set current control scheme text
        mvmtText.text = "W - Right \n A - Left \n S - Down \n D - UP ";
        firetxt.text  = "Fire Weapons \nLeft Click\n\n\nSelect/Equip items click";
        if (schemeGetter != null)
        {
            if (schemeGetter.GetCurrentScheme() == "Left")
            {
                mvmtText.text = "Right Arrow - Right \n Left Arrow - Left \n Down Arrow - Down \n Up Arrow - UP ";
                firetxt.text  = "Fire Weapons \nLeft Click\n\n\nSelect/Equip items click";
            }
            else if (schemeGetter.GetCurrentScheme() == "Controller")
            {
                mvmtText.text = "B - Right \n X - Left \n A - Down \n Y - UP ";
                firetxt.text  = "Fire Weapons \n'RT'\n\n\nSelect/Equip items 'RT'";
            }
        }
        creditsMenu = GameObject.FindGameObjectWithTag("CreditsMenu");
        schemeMenu  = GameObject.FindGameObjectWithTag("SchemeMenu");
        schemeMenu.SetActive(false);
        infoMenu.SetActive(false);
        creditsMenu.SetActive(false);



        //movement stuff

        //mvmtText = GameObject.FindGameObjectWithTag("MvmtText").GetComponent<TextMeshProUGUI>();
    }
    // Start is called before the first frame update
    void Start()
    {
        var fireEmission = fireSystem.emission;

        fireEmission.rateOverTime = 0;

        var emission = smokeSystem.emission;

        emission.rateOverTime = 0;

        schemeObject = GameObject.FindGameObjectWithTag("SchemeGetter").GetComponent <GetScheme>();

        riverNodesArray = GameObject.FindGameObjectsWithTag("RiverNode");
        foreach (GameObject node in riverNodesArray)
        {
            riverNodes.Add(node);
        }
        closestNode      = riverNodes[0];
        closestNodeIndex = 0;
        //for(int i = 0; i < riverNodes.Length; i ++)
        //{
        //    if (Vector3.Distance(closestNode.transform.position, gameObject.transform.position) >
        //        Vector3.Distance(riverNodes[i].transform.position, gameObject.transform.position))
        //    {
        //        closestNode = riverNodes[i];
        //        closestNodeIndex = i;
        //    }
        //}

        foreach (GameObject node in riverNodes)
        {
            if (Vector3.Distance(closestNode.transform.position, gameObject.transform.position) >
                Vector3.Distance(node.transform.position, gameObject.transform.position))
            {
                closestNode = node;
            }
        }
    }
Exemple #4
0
 private void Start()
 {
     Physics2D.IgnoreCollision(GameObject.FindGameObjectWithTag("Enemy").GetComponent <BoxCollider2D>(), GetComponent <Collider2D>(), true);
     Physics2D.IgnoreCollision(GameObject.FindGameObjectWithTag("River").GetComponent <Collider2D>(), GetComponent <Collider2D>(), true);
     schemeGetter = GameObject.FindGameObjectWithTag("SchemeGetter").GetComponent <GetScheme>();
 }