Ejemplo n.º 1
0
    private void MoveSetupNonBlocking(string[] parms, MoveType type)
    {
        //find actor in scene with name parameters[0]
        Actor actor = SceneObjects.GetActor(parms[0]);

        //find location in scene with name parameters[1]
        Actor location = SceneObjects.GetActor(parms[1]);

        if (actor == null)
        {
            Debug.LogWarning($"No actor with name {parms[0]} found. Continuing dialogue");
            return;
        }

        if (location == null)
        {
            Debug.LogWarning($"No location with name {parms[1]} found. Continuing dialogue");
            return;
        }

        if (type == MoveType.move)
        {
            //Debug.Log("move to " + location.Position);
            actor.MoveActor(location.transform.position);
        }

        if (type == MoveType.instant)
        {
            actor.SetActorPosition(location.transform.position);
        }
    }
Ejemplo n.º 2
0
    private void MoveSetupBlocking(string[] parm, System.Action onComplete, MoveType type)
    {
        //find actor in scene with name parameters[0]
        Actor actor = SceneObjects.GetActor(parm[0]);

        //find location in scene with name parameters[1]
        Actor location = SceneObjects.GetActor(parm[1]);

        if (actor == null)
        {
            Debug.LogWarning($"No actor with name {parm[0]} found. Continuing dialogue");
            onComplete?.Invoke();
            return;
        }
        if (location == null)
        {
            Debug.LogWarning($"No actor with name {parm[1]} found. Destination not found, continuing dialogue");
            onComplete?.Invoke();
            return;
        }

        if (type == MoveType.wait)
        {
            actor.MoveActorBlocking(location.transform.position, onComplete);
        }
    }
Ejemplo n.º 3
0
    private void Face(string[] parameters)
    {
        if (parameters == null)
        {
            return;
        }
        //Debug.Log("facing" + parameters[0] + parameters[1] + parameters[2]);


        int actorNameIndex = 0;

        Vector3 faceDirection = Vector3.zero;

        if (parameters.Length == 3)
        {
            faceDirection.x = float.Parse(parameters[1]);
            faceDirection.z = float.Parse(parameters[2]);
        }

        /**
         * Vector2 faceDirection = Vector2.zero;
         * if (parameters[0] == "up")
         * {
         *  faceDirection = Vector2.up;
         *  Debug.Log("facing up");
         * }
         * else if (parameters[0] == "left")
         * {
         *  faceDirection = Vector2.left;
         *  Debug.Log("facing left");
         * }
         * else if (parameters[0] == "down")
         * {
         *  faceDirection = Vector2.down;
         *  Debug.Log("facing down");
         * }
         * else if (parameters[0] == "right")
         * {
         *  faceDirection = Vector2.right;
         *  Debug.Log("facing right");
         * }
         * else
         * {
         *  Debug.Log("movment facing");
         *  actorNameIndex = 0;
         * }
         **/

        //Debug.Log("setting facing to " + faceDirection);
        Actor a = SceneObjects.GetActor(parameters[actorNameIndex]);

        if (a != null)
        {
            a.SetFacingEvent?.Invoke(faceDirection);
        }
    }