Ejemplo n.º 1
0
    public Executable TriggerTurn(int turnIndex)
    {
        if(turnIndex > 0) {
            WrapperExec we = new WrapperExec("verticalPlatform_move");

            Hashtable h = iTween.Hash(
                    "amount", (Vector3.up * cycle[turnIndex % cycle.Length]),
                    "speed", 1,
                    "easetype", iTween.EaseType.linear,
                    "oncomplete", (Action)( we.Terminate ));
            we.start = delegate {
                GameState.camCtrl.Focus(transform);
                foreach (DungeonEntity de in entity.AllAbove(true)) {
                    iTween.MoveAdd( de.gameObject, h);
                }

            };

            we.end = delegate {
                entity.erenderer.height += cycle[turnIndex % cycle.Length];
                transform.GetChild(0).localPosition += Vector3.up * cycle[turnIndex % cycle.Length];
                foreach (DungeonEntity de in entity.AllAbove(true)) {
                     de.SyncWorldToTile();
                }
            };

            return we;
        }
        return null;
    }
Ejemplo n.º 2
0
    public Executable Trigger(Executable e)
    {
        if (!solved) {
            foreach (GameObject sobj in sObjects) {
                Solvable s = sobj.GetComponent(typeof(Solvable)) as Solvable;
                if (!s.solved) return null;
            }
            WrapperExec we = new WrapperExec("door_open");
            we.start = delegate {
                GameState.camCtrl.Focus(transform);
                Camera.mainCamera.audio.PlayOneShot(Resources.Load("audio/se/dooropen") as AudioClip);
                iTween.RotateAdd(gameObject, iTween.Hash(
                    "amount", Vector3.up * 90,
                    "time", 1.5f,
                    "oncomplete", (Action) we.Terminate));
            };

            we.end = delegate {
                Tile t = GameState.mState.grid[exitJ, exitI];
                t.exitable = true;
                solved = true;
            };

            return we;
        }
        return null;
    }
Ejemplo n.º 3
0
    public Executable Trigger(Executable trigger)
    {
        Debug.Log("trigger");
        Tile t = entity.tile;
        if (!solved && t.entities.Count > entity.tileIndex + 1) {
            DungeonEntity pe = t.entities[entity.tileIndex + 1];
            Pot p = pe.transform.GetComponent<Pot>();
            if (p != null && p.color == color) {

                WrapperUpdateFunction upf = delegate {
                    panelRenderer.material.color = Color.Lerp(panelRenderer.material.color, targetColor, 0.2f);
                    return (panelRenderer.material.color == targetColor);
                };

                WrapperEndFunction ef = delegate {
                    solved = true;
                };

                WrapperExec we = new WrapperExec("floorPanel_change", WrapperExec.DefaultDoNothing, upf, ef);
                return we;
            }
        }
        return null;
    }