Example #1
0
File: Player.cs Project: 3ldh/Zappy
    private IEnumerator MoveLeft()
    {
        while (coroutineManager.IsTrackedCoroutineRunning())
        {
            yield return(waitForEndOfFrame);
        }
        Vector3 dest = GetMap.WorldToGrid(transform.position + Map.West);

        // print("MoveRIght : position before : " + transform.position + " dest : " + dest);
        if (!GetMap.Contains(dest))
        {
            SpawnParticle(transform.position + (Map.West * GetMap.ScaleFactor.x));
        }
        yield return(coroutineManager.StartTrackedCoroutine(MoveOverSeconds(transform.position + (Map.West * GetMap.ScaleFactor.x), speed)));

        if (!GetMap.Contains(dest))
        {
            transform.position = new Vector3(GetMap.GridToWorld(Map.East * (GetMap.dimension.x - 1)).x, transform.position.y, transform.position.z);
        }
    }
Example #2
0
File: Player.cs Project: 3ldh/Zappy
    private IEnumerator MoveDown()
    {
        while (coroutineManager.IsTrackedCoroutineRunning())
        {
            yield return(waitForEndOfFrame);
        }
        // print("MoveDOwn : position before : " + transform.position);
        Vector3 dest = GetMap.WorldToGrid(transform.position + Map.South);

        if (!GetMap.Contains(dest))
        {
            SpawnParticle(transform.position + (Map.South * GetMap.ScaleFactor.z));
        }
        yield return(coroutineManager.StartTrackedCoroutine(MoveOverSeconds(transform.position + (Map.South * GetMap.ScaleFactor.z), speed)));

        if (!GetMap.Contains(dest))
        {
            transform.position = new Vector3(transform.position.x, transform.position.y, GetMap.GridToWorld(Map.North * (GetMap.dimension.y - 1)).z);
        }
    }