示例#1
0
文件: Ship.cs 项目: mono26/GGJ2018-2
    private void OnTriggerEnter2D(Collider2D _collider)
    {
        // Debug.LogError(_collider.gameObject.name);
        if (_collider.CompareTag("GravitationField"))
        {
            // Changes active buttons on GUI if it enters a planet
            PlayerInOrbit();

            isOnGravitationField = true;
        }

        if (_collider.CompareTag("ShootZone"))
        {
            PlanetWeapon weapon = _collider.GetComponent <PlanetWeapon>();
            weapon.SetTarget(transform);
        }
    }
示例#2
0
文件: Ship.cs 项目: mono26/GGJ2018-2
    void OnTriggerExit2D(Collider2D _collider)
    {
        if (_collider.CompareTag("GravitationField"))
        {
            // Changes active buttons on GUI if it goes out of a planet
            PlayerInOrbit();
            UpdateButton();

            if (atractorRayComponent.IsAlienRayOn)
            {
                ToggleShipRay();
            }

            isOnGravitationField = false;
        }

        if (_collider.CompareTag("ShootZone"))
        {
            PlanetWeapon weapon = _collider.GetComponent <PlanetWeapon>();
            weapon.SetTarget(null);
        }
    }