Beispiel #1
0
        /// <summary>
        /// &lt;&lt;turn CHARACTER DIRECTION&gt;&gt;\n
        ///
        /// Causes CHARACTER to face in DIRECTION, where DIRECTION is
        /// either "left" or "right" (DIRECTION is case-insensitive).
        ///
        /// </summary> <example>
        ///
        /// ## Examples
        ///
        ///     <<turn Ibuki Right>>
        /// Make Ibuki face towards the right.
        /// </example>
        public void Turn(string[] args)
        {
            #region Argument handling
            Assert.IsTrue(args.Length >= 2);
            string charName   = args[0];
            string facingName = args[1];
            #endregion

            Puppet        charPuppet = puppetMaster.GetPuppet(charName);
            Puppet.Facing newFacing;
            if (facingName.Equals("left", StringComparison.InvariantCultureIgnoreCase))
            {
                newFacing = Puppet.Facing.Left;
            }
            else if (facingName.Equals("right", StringComparison.InvariantCultureIgnoreCase))
            {
                newFacing = Puppet.Facing.Right;
            }
            else
            {
                throw new InvalidEnumArgumentException("Invalid facing: " + facingName);
            }

            Debug.Log("Changing facing to " + newFacing.ToString());

            charPuppet.SetFacing(newFacing);
        }
Beispiel #2
0
        private void SetTexture(string[] args)
        {
            Assert.IsTrue(args.Length >= 2);
            string charName  = args[0];
            string indexName = args[1];

            Puppet charPuppet = puppetMaster.GetPuppet(charName);
            int    index      = int.Parse(indexName);

            charPuppet.SetTexture(index);
        }
Beispiel #3
0
        private Puppet MakePuppet(string characterName)
        {
            GameObject newPuppetObj = Instantiate(puppetPrefab, transform);

            Puppet newPuppet = newPuppetObj.GetComponent <Puppet>();

            newPuppet.Warp(puppetSpawnPoint);

            // TODO Configure character stuff.
            newPuppetObj.name = characterName;                  // TODO Puppet should be able to set this itself.

            return(newPuppet);
        }
Beispiel #4
0
        /// <summary>
        /// &lt;&lt;move CHARACTER [to] TO_POINT [from FROM_POINT] [now|slowly|quickly] [and wait]&gt;&gt;
        /// <br>
        /// (Continued; see subsection)
        ///
        /// Causes CHARACTER to slide over to TO_POINT. If FROM_POINT is
        /// specified, the character will warp there before moving.
        /// If trying to move a character into view, please make sure to
        /// specify FROM_POINT. Otherwise, your character may start
        /// somewhere you weren't expecting!
        ///
        /// Points are created in Unity and are listed in the "puppetPoints"
        /// variable. For this reason, the number and names of points is
        /// flexible, and could possibly change. Current points PROBABLY are:
        ///		offleft, left, middle, right, offright
        ///
        ///
        /// ### Stacking
        ///
        /// If two or more characters end up on the same point, then
        /// they'll "stack," with their positions being staggered
        /// so they aren't all on the same position.
        ///
        /// Note that this is still in development. More details on
        /// how this looks/works once that's done.
        ///
        ///
        /// ### Pushing and Pulling
        ///
        ///     <<move CHARACTER [to] TO_POINT [from FROM_POINT] [now|slowly|quickly] [and wait]
        ///            [and pull|push TARGET1 [, TARGET2, TARGET3, ...] [to TARGET_POSITION]]>>
        ///
        /// If **pull** or **push** is given, then every TARGET gets
        /// pulled/pushed by CHARACTER. It's possible to push/pull
        /// several targets at a time, separating their names with
        /// spaces.
        ///
        /// By default, each TARGET ends up on the same spot as
        /// CHARACTER. However, if TARGET_POSITION is also specified,
        /// then all TARGETs end up there.
        ///
        /// The assumption is that CHARACTER will move past every
        /// TARGET. Any TARGETs which CHARACTER does not go past
        /// won't be pushed. (This is subject to change?)
        ///
        ///
        /// </summary> <example>
        ///
        /// ## Examples
        ///
        ///     <<move Ibuki Middle and wait>>
        /// Move Ibuki to the middle (from wherever she was before).
        /// The VN will wait until Ibuki finishes moving.
        ///
        ///     <<move Ibuki to Middle>>
        /// Same as before, except without the waiting. (And it looks
        /// a little more like English.)
        ///
        ///     <<move Ibuki Middle now>>
        /// Same as before, but Ibuki will "teleport" to the middle.
        ///
        ///     <<move Ibuki to Left from OffLeft>>
        /// Move Ibuki from the off the left edge of the screen to the left position.
        /// Use something like this if the character was off screen.
        ///
        ///     <<move Ibuki to Middle and push Nimura to Left and push Ami to OffLeft>>
        /// Move Ibuki to the middle.<br>
        /// When Ibuki reaches Nimura, Nimura will be forced over to the left.<br>
        /// When Ibuki reaches Ami, Ami will be forced off the left edge.
        ///
        ///     <<move Ibuki to Middle and push Nimura, Ami to Left>>
        /// Move Ibuki to the middle.<br>
        /// When Ibuki reaches Nimura and/or Ami, they will both be to the Left position.
        ///
        ///
        /// </example>
        /// \warning Implementation in progress
        public void Move(string[] args)
        {
            #region Argument handling
            Assert.IsTrue(args.Length >= 2);
            string charName = args[0];
            string destName = "";
            string fromName = "";

            for (int i = 1; i < args.Length; i++)
            {
                switch (args[i])
                {
                case "to":
                    i++;
                    destName = args[i];
                    break;

                case "from":
                    i++;
                    fromName = args[i];
                    break;

                case "and":
                    i++;
                    Assert.AreEqual(args[i], "wait");

                    // TODO Implement 'move ... and wait'
                    Debug.LogWarning("'move ... and wait' isn't supported yet!");
                    break;

                case "now":
                    // TODO Implement 'now'
                    // TODO Implement 'slowly'
                    // TODO Implement 'quickly'
                    Debug.LogWarning("'now' isn't supported yet!");
                    break;

                default:
                    // Only take an unlabeled parameter if we don't
                    // already have a destination.
                    if (string.IsNullOrEmpty(destName))
                    {
                        destName = args[i];
                    }
                    else
                    {
                        ReportInvalidArgument("move", args[i]);
                    }
                    break;
                }
            }
            #endregion

            Puppet charPuppet = puppetMaster.GetPuppet(charName);

            if (!string.IsNullOrEmpty(fromName))
            {
                charPuppet.Warp(GetNamedPoint(fromName));
            }

            charPuppet.SetMovementDestination(GetNamedPoint(destName));
        }