Beispiel #1
0
    protected virtual void Update()
    {
        if (transform.parent == null)
        {
            Destroy(gameObject);
        }
        else if (isStartPlanet == false)
        {
            if (transform.parent.GetComponent <Sector>().nowSectorTile.index == 4)
            {
                targetScale = 0.75f;
            }
            else if (transform.parent.GetComponent <Sector>().nowSectorTile.index == 3)
            {
                targetScale = 0.9f;
            }
            else if (transform.parent.GetComponent <Sector>().nowSectorTile.index == 2)
            {
                targetScale = 1.1f;
            }
            else if (transform.parent.GetComponent <Sector>().nowSectorTile.index == 1)
            {
                targetScale = 1.5f;
            }
        }

        if (isMove == false)
        {
            isMove = true;
            StartCoroutine(CoroutineUtil.LerpMove(this.gameObject, this.transform.position, targetPos, 2));
            StartCoroutine(CoroutineUtil.LerpScale(this.gameObject, this.transform.localScale, new Vector3(1f, 1f, 1f) * targetScale, 2));
        }
    }
Beispiel #2
0
    public void Emigration(PlanetBase target)
    {
        gameObject.SetActive(true);
        transform.localScale  = new Vector3(1, 1, 1) * (1f / transform.parent.localScale.x);
        emigrationTarget      = target;
        uiMgr.isEmigrationEnd = false;
        StartCoroutine(CoroutineUtil.LerpMove(this.gameObject, this.gameObject.transform.position,
                                              target.transform.position, 1, true, false, this.gameObject, "MoveEnd"));
        Vector3 t     = target.transform.position - transform.position;
        float   angle = Mathf.Rad2Deg * Mathf.Atan2(t.y, t.x);

        transform.rotation = Quaternion.identity;
        transform.Rotate(new Vector3(0, 0, -90 + angle));
    }