示例#1
0
    // Update is called once per frame
    void Update()
    {
        cam = GameObject.FindGameObjectWithTag("MainCamera");
        cam.transform.SetParent(transform);
        cam.transform.localPosition = new Vector3(0, 0, -10);

        if (Input.GetButtonDown("Fire1"))
        {
            characterType.Primary();
        }
        else if (Input.GetButtonDown("Fire2"))
        {
            characterType.Secondary();
        }
        else if (Input.GetButtonDown("Fire3"))
        {
            characterType.Tertiary();
        }
        else if (Input.GetButtonDown("Hypno"))
        {
            if (characterType.name != "Hypno")
            {
                //StartCoroutine(NoNeutral(2f));
                PlayerController np = og.GetComponent <PlayerController>();
                np.enabled = true;
                characterType.rotationTrans.SetActive(false);
                np.characterType.rotationTrans.SetActive(true);
                GetComponent <Rigidbody2D>().isKinematic = true;
                GetComponent <BoxCollider2D>().enabled   = false;
                np.name      = name;
                np.name.text = np.GetComponent <CharacterType>().name;
                cam.transform.SetParent(og.transform);
                cam.transform.localPosition = new Vector3(0, 0, -10);
                characterType.dead          = true;//it should kill itself
                characterType.Die();



                // Destroy(this);
            }
            else
            {
                StartCoroutine(Hypno());
            }
        }

        UpdateUI();
        CheckState();
    }