Пример #1
0
    void Update()
    {
        if (!hasValidPivot)
        {
            return;
        }

        if (Input.GetKey(KeyCode.Space))
        {
            // This gets us outside this state
            gameObject.SendMessage("ExitPlanet");
            pivotController.FreeEntity(gameObject);
            AudioManager.Instance.PlaySound(AudioManager.SFX.JumpSpace);
            return;
        }

        if (Input.GetKey(KeyCode.P))
        {
            if (pivotController.CanPlanetBeEntered())
            {
                transform.localScale = new Vector3(1, 1, 1);
                Vector3 enterPos = pivotController.GetPlanetEntryLocation();
                // This gets us outside this state
                gameObject.SendMessage("EnterPlanet", enterPos);
                pivotController.FreeEntity(gameObject);
                pivotController.SetNoEntry();
                CameraFollowSmooth.goIn();
                return;
            }
        }


        if (Input.GetAxis("Horizontal") != 0)
        {
            pivotController.Rotate(rotationSpeed * -Input.GetAxis("Horizontal"));
        }
        if (Input.GetAxis("Horizontal") > 0 && !faceRight)
        {
            flip();
        }
        else if (Input.GetAxis("Horizontal") < 0 && faceRight)
        {
            flip();
        }
    }
Пример #2
0
    // Geri, please erase this commented code
    // if target is not being used
    //   private Transform target;
    //// Use this for initialization
    //void Start () {
    //       target = position.transform;
    //   }

    void OnTriggerEnter2D(Collider2D other)
    {
        if (other.tag == "Player")
        {
            if (!isExterior)
            {
                GameObject temp = other.transform.parent.gameObject;
                temp.transform.position   = position.transform.position;
                temp.transform.localScale = new Vector3(1, 1, 1);
                PlayerVisController.Instance._renderer.sprite = space;
                InPlanetController.faceRight = true;
                CameraFollowSmooth.goSpace();
                PlayerManager.Instance.ExitPlanet();
                GameObject tempPm = GameObject.Find("Player");
                tempPm.GetComponent <PlayerManager>().objectiveCompleted();
                Destroy(particles);
            }
            else
            {
                InPlanetController.Instance.enterLevel();
            }
        }
    }