Beispiel #1
0
    public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        gameObject = animator.gameObject;

        destinationSetter = gameObject.GetComponent <AIDestinationSetter>();
        aiPath            = gameObject.GetComponent <AIPath>();
        npc   = gameObject.GetComponent <NPC>();
        clown = gameObject.GetComponent <Clown>();

        var gm = GameObject.FindGameObjectWithTag("GameManager");

        gameManager   = gm.GetComponent <GameManager>();
        layoutManager = gm.GetComponent <LayoutGenerator>();

        // Set Location
        npc.DestinationSlave.transform.position = layoutManager.GetRandomSpawnPoint();
        destinationSetter.target = npc.DestinationSlave.transform;

        // Make friend follow clown
        friend = npc.ClosestFriend;
        friend.GetComponent <Friend>().OnGetKidnapped();

        clown.KidnappedFriend = friend;

        animator.SetBool("Is Kidnapping", true);
    }
Beispiel #2
0
    public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        // Get references.
        gameObject = animator.gameObject;

        destinationSetter = gameObject.GetComponent <AIDestinationSetter>();
        aiPath            = gameObject.GetComponent <AIPath>();
        npc   = gameObject.GetComponent <NPC>();
        clown = gameObject.GetComponent <Clown>();

        var gm = GameObject.FindGameObjectWithTag("GameManager");

        gameManager   = gm.GetComponent <GameManager>();
        layoutManager = gm.GetComponent <LayoutGenerator>();

        // Reset Friend.
        var friend = clown.KidnappedFriend;

        if (friend != null)
        {
            friend.GetComponent <NPC>().StateMachine.Play("Lost", 0);
            friend.GetComponent <Friend>().Status = FriendStatus.FollowingPlayer;
            clown.KidnappedFriend = null;
        }

        // Set target location.
        targetLocation           = GetRandomNode().position;
        destinationSetter.target = npc.DestinationSlave.transform;

        animator.SetBool("Reached Destination", false);
    }
Beispiel #3
0
                  new[] { "[1000,3000]", "[6000,8000]", "[4000,12000]" })] // todo : second lyric start time should be 6000 but can be ignored now.
        public void TestApplyLayoutTime(string[] lyricTexts, string[] actualTimes)
        {
            var lyrics = TestCaseTagHelper.ParseLyrics(lyricTexts);

            var generator = new LayoutGenerator(generatorConfig());

            generator.ApplyLayout(lyrics);

            Assert.AreEqual(lyrics.Select(x => $"[{x.StartTime},{x.EndTime}]").ToArray(), actualTimes);
        }
Beispiel #4
0
        [TestCase(null, null)]                                     // should not crash in null.
        public void TestApplyLayoutIndex(string[] texts, int[] actualLayoutIds)
        {
            var lyrics = texts?.Select(x => new Lyric {
                Text = x
            }).ToArray();

            var generator = new LayoutGenerator(generatorConfig());

            generator.ApplyLayout(lyrics);

            Assert.AreEqual(lyrics?.Select(x => x.LayoutIndex).ToArray(), actualLayoutIds);
        }
    // Use this for initialization
    void Start()
    {
        Player       = ControlledObject = GameObject.FindGameObjectWithTag("Player");
        CameraObject = GameObject.FindGameObjectWithTag("MainCamera");

        generator = GetComponent <LayoutGenerator>();

        if (!disableAutomaticGeneration)
        {
            GenerateLayout();
            SpawnCharacters();
        }
    }
Beispiel #6
0
    public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        gameObject = animator.gameObject;

        destinationSetter = gameObject.GetComponent <AIDestinationSetter>();
        aiPath            = gameObject.GetComponent <AIPath>();
        npc = gameObject.GetComponent <NPC>();

        var gm = GameObject.FindGameObjectWithTag("GameManager");

        gameManager   = gm.GetComponent <GameManager>();
        layoutManager = gm.GetComponent <LayoutGenerator>();

        // Set Location
        targetLocation           = GetRandomNode().position;
        destinationSetter.target = npc.DestinationSlave.transform;

        animator.SetBool("Reached Destination", false);
    }
Beispiel #7
0
        public MainClass() : base("Cod2d")
        {
            SetDefaultSize(1920, 1080);
            SetPosition(WindowPosition.Center);
            DeleteEvent += delegate
            {
                Application.Quit();
            };

            DrawingArea darea = new DrawingArea();

            darea.ExposeEvent += OnExpose;

            Add(darea);

            if (project == null)
            {
                string[] files = { "csFiles.json", "csEntites.json", "csTree.json", "csProject.json", "csBuilding.json" };

                IParser csParser = new GitHubParser(_owner, _project, _username, _password);

                IEnumerable <IFile> csFiles;
                EntityCollection    csEnitities;
                Node <Entity>       csRoot;
                Node <Building>     csBuilding;

                if (!File.Exists(files[0]))
                {
                    csFiles = csParser.Read();
                    SaveClass(csFiles, files[0]);
                }
                else
                {
                    csFiles = ReadClass <IEnumerable <GitHubFile> >(files[0]);
                }

                if (!File.Exists(files[1]))
                {
                    csEnitities = Project.MakeEntities(csFiles);
                    SaveClass(csEnitities, files[1]);
                }
                else
                {
                    csEnitities = ReadClass <EntityCollection>(files[1]);
                }

                if (!File.Exists(files[2]))
                {
                    csRoot = Project.MakeTree(csEnitities);
                    SaveClass(csRoot, files[2]);
                }
                else
                {
                    csRoot = ReadClass <Node <Entity> >(files[2]);
                }

                if (!File.Exists(files[4]))
                {
                    csBuilding = LayoutGenerator.GenerateSize(csRoot);
                    SaveClass(csBuilding, files[4]);
                }
                else
                {
                    csBuilding = ReadClass <Node <Building> >(files[4]);
                }

                Vivacity.Library.Model.Tree tree = new Vivacity.Library.Model.Tree
                {
                    Root = csBuilding
                };

                tree.Normalize(1920, 1080);

                project = new Project(csEnitities, csRoot, ProjectType.CSharp);
                SaveClass(project, files[3]);
            }
        }
 // Use this for initialization
 void Awake()
 {
     geometryGenerator = GetComponent <GeometryGenerator>();
     layoutGenerator   = GetComponent <LayoutGenerator>();
     GenerateLevel();
 }