示例#1
0
        //GameData m_Data = new GameData();

        public override void Start()
        {
            m_LargeRocks = new List <Rock>();
            m_MedRocks   = new List <Rock>();
            m_SmallRocks = new List <Rock>();

            m_RockPrefab   = Content.Load <Prefab>("Asteroid");
            m_PlayerPrefab = Content.Load <Prefab>("Player");
            m_UFOPrefab    = Content.Load <Prefab>("UFO");

            Entity player = m_PlayerPrefab.Instantiate().First();

            SceneSystem.SceneInstance.RootScene.Entities.Add(player);
            m_Player = player.Components.Get <Player>();
            m_Player.Initilize(m_Random);
            Entity ufo = m_UFOPrefab.Instantiate().First();;

            SceneSystem.SceneInstance.RootScene.Entities.Add(ufo);
            m_UFO = ufo.Components.Get <UFO>();
            m_UFO.Initialize(m_Player, m_Random);
            SpawnLargeRocks(m_LargeRockCount);

            m_Background        = Content.Load <Sound>("Background").CreateInstance();
            m_Background.Volume = 0.50f;
        }
示例#2
0
        public void Initialize(Random random, Player player, UFO UFO)
        {
            m_Radius = 2.9f;
            m_Player = player;
            m_UFO    = UFO;
            m_Points = 20;
            m_Random = random;

            int m_RockType = random.Next(0, 4);

            if (m_RockType == 1)
            {
                m_RockOne();
            }
            else if (m_RockType == 2)
            {
                m_RockTwo();
            }
            else if (m_RockType == 3)
            {
                m_RockThree();
            }
            else
            {
                m_RockFour();
            }

            m_Rock = new Entity();
            m_Rock.Add(m_RockMesh);
            this.Entity.AddChild(m_Rock);
        }
示例#3
0
        public void ReturnScoreDeadUFO()
        {
            var ufo = new UFO(new Point(1, 1), 10);

            ufo.RemoveLife();
            Assert.AreEqual(10, ufo.ReturnScore());
        }
示例#4
0
        public void RemoveLife()
        {
            var ufo = new UFO(new Point(1, 1), 10);

            ufo.RemoveLife();
            Assert.AreEqual(0, ufo.CountLife);
        }
示例#5
0
        public void CheckIsDead()
        {
            var ufo = new UFO(new Point(1, 1), 10);

            Assert.AreEqual(false, ufo.IsDead);
            ufo.RemoveLife();
            Assert.AreEqual(true, ufo.IsDead);
        }
示例#6
0
        private void SpawnUFO()
        {
            UFO ufo = m_ufoFactory.Create();

            var ufoType = RandomEnum <UFOType> .Get();

            var score   = m_ufoDataFactory.GetScore(ufoType);
            var ufoData = m_ufoDataFactory.GetData(ufoType);

            ufo.Score = score;
            ufo.transform.position = GetRandomStartPosition(ufo.Scale);
        }
示例#7
0
 public void Spawn(Vector3 position, float scale, float speed, int points, Random random, Player player, UFO UFO)
 {
     Initialize(random, player, UFO);
     m_Speed = speed;
     Spawn(position);
     m_Rock.Transform.Scale = new Vector3(scale);
     m_Radius = m_Radius * scale;
     m_Points = points;
 }
示例#8
0
 public static void SetUFOToPool(UFO ufo)
 {
     Instance.m_ufoSpawner.SetObjectToPool(ufo);
 }
示例#9
0
        public void ReturnScoreNotDeadUFO()
        {
            var ufo = new UFO(new Point(1, 1), 10);

            Assert.AreEqual(0, ufo.ReturnScore());
        }