예제 #1
0
    public void Kiss(string cmd, string[] args)
    {
        if (cmd != "KISS")
        {
            return;
        }
        if (args.Length != 1)
        {
            console.InvokeOnErrorCommand(cmd);
            return;
        }

        if (args[0] == "PRINCESS")
        {
            GameObject princess = GameObject.FindGameObjectWithTag("Princess");
            if (princess == null)
            {
                console.InvokeOnErrorCommand(cmd);
                return;
            }
            ObjectEntity entity = princess.GetComponent <ObjectEntity>();
            if (!visibleObjects.Contains(entity))
            {
                console.InvokeOnErrorCommand(cmd);
                return;
            }
            EndGame end = princess.GetComponent <EndGame>();
            if (end.isVisible)
            {
                end.Finish();
            }
        }
        else
        {
            ErrorCommand("");
            ErrorCommand("");
            ErrorCommand("");
            ErrorCommand("");
            console.InvokeOnErrorCommand(cmd);
        }
    }