Exemple #1
0
        public void AfterTest()
        {
            _goal = null;

            _otherSpecies = null;
            _species      = null;

            _ownerSpecies = null;
            _pathfinding  = null;

            _wildlifeService = null;
            _params          = null;
        }
Exemple #2
0
        public void BeforeTest()
        {
            _params = new FollowTargetGoalParams {
                ValidTargetDesirability = 1.0f, LoseFollowRadiusSquared = 2000.0f, FollowRadius = 10.0f
            };
            _wildlifeService = new MockWildlifeService();

            var owner = new GameObject();

            _pathfinding  = owner.AddComponent <MockPathfindingComponent>();
            _ownerSpecies = owner.AddComponent <MockSpeciesComponent>();

            _species      = new GameObject().AddComponent <MockSpeciesComponent>();
            _otherSpecies = new GameObject().AddComponent <MockSpeciesComponent>();

            _goal = new FollowTargetGoal(owner, _params, _wildlifeService);
        }
        public void BeforeTest()
        {
            _species = new GameObject().AddComponent <TestSpeciesComponent>();
            _species.gameObject.AddComponent <TestUnityMessageEventDispatcherComponent>().TestAwake();

            _positiveClip = Resources.Load <AudioClip>("Test/Audio/Test_Clip_1");
            _negativeClip = Resources.Load <AudioClip>("Test/Audio/Test_Clip_2");

            _species.SpeciesAudioSource = _species.gameObject.AddComponent <AudioSource>();
            _species.CryClips           = new List <SpeciesComponent.CryAudioClipEntry>
            {
                { new SpeciesComponent.CryAudioClipEntry(ECryType.Positive, _positiveClip) },
                { new SpeciesComponent.CryAudioClipEntry(ECryType.Negative, _negativeClip) }
            };
            Assert.IsNotNull(_species.CryClips[0]);
            Assert.IsNotNull(_species.CryClips[1]);

            new GameObject().AddComponent <TestGameServiceProvider>().TestAwake();

            _wildlife = new MockWildlifeService();
            GameServiceProvider.CurrentInstance.AddService <IWildlifeServiceInterface>(_wildlife);
        }