예제 #1
0
        /// <summary>
        /// If light has spawned before minimum light spawn time,
        /// always spawn it to other side of the panel
        /// </summary>
        /// <param name="side"> Which side the light was spawned before </param>
        /// <returns> opposite side of the panel </returns>
        private LightSide SpawnOnOtherSide(LightSide side)
        {
            LightSide result = LightSide.right;

            if (side == LightSide.right)
            {
                result = LightSide.left;
            }
            return(result);
        }
예제 #2
0
 /// <summary>
 /// Turns the left light on and
 /// </summary>
 public void TurnTriggetLightOn(LightSide side, int noteNumber)
 {
     if (side == LightSide.left)
     {
         _leftTrigger.ActivateLight(_triggerActiveTimeBeforeMiss, noteNumber);
     }
     else if (side == LightSide.right)
     {
         _rightTrigger.ActivateLight(_triggerActiveTimeBeforeMiss, noteNumber);
     }
 }
 /// <summary>
 /// Initializes the moving light on the panel
 /// </summary>
 /// <param name="waypoints"> Waypoints that the light moves along</param>
 /// <param name="parent"> the panel that initializes the light</param>
 public void Init(GameObject[] waypoints, KanteleHeroPanel parent, float speed, LightSide side, int noteNumber)
 {
     _speed  = speed;
     _parent = parent;
     _currentWaypointIndex = 1;
     _noteNumber           = noteNumber;
     Waypoints             = waypoints;
     transform.position    = waypoints[0].transform.position;
     _startPos             = transform.position;
     startTime             = 0;
     _side          = side;
     _waypointSpeed = Vector3.Distance(transform.position, Waypoints[_currentWaypointIndex].transform.position);
 }
예제 #4
0
        /// <summary>
        /// Spawns light on the panel that start moving towards the end of the rail
        /// </summary>
        /// <param name="waypoints"> Waypoints for the correct side </param>
        /// <param name="side"> Decide which side the light moves on the panel </param>
        private void SpawnLight(GameObject[] waypoints, LightSide side, int noteNumber)
        {
            KanteleHeroLight light = _kanteleLights.GetPooledObject();

            if (light != null)
            {
                if (side == LightSide.left)
                {
                    light.Init(waypoints, this, _lightMoveSpeed, side, noteNumber);
                    light.GetComponent <Renderer>().material = LeftLightMaterial;
                }
                else
                {
                    light.Init(waypoints, this, _lightMoveSpeed, side, noteNumber);
                    light.GetComponent <Renderer>().material = RightLightMaterial;
                }
            }
        }
예제 #5
0
        // Update is called once per frame
        void Update()
        {
            // Debugging purposes only
            //if(Input.GetKeyDown(KeyCode.C))
            //{
            //    ActivatePanel();

            //}
            if (PanelActive)
            {
                if (_currentNote < _noteCount)
                {
                    UpdateSpawnTimer();
                }

                if (_canSpawn)
                {
                    if (_spawnTimer > _minSpawnOnSameSide)
                    {
                        _spawnSide = RandomSide();
                    }
                    else
                    {
                        _spawnSide = SpawnOnOtherSide(_spawnSide);
                    }
                    if (_spawnSide == LightSide.left)
                    {
                        SpawnLight(_LeftWaypoints, _spawnSide, _currentNote - 1);
                    }
                    else if (_spawnSide == LightSide.right)
                    {
                        SpawnLight(_rightWaypoints, _spawnSide, _currentNote - 1);
                    }
                    _canSpawn = false;
                }
            }
            if (_misses >= _missLights.Length)
            {
                _misses     = 0;
                _difficulty = 2f;
                DeactivatePanel();
            }
        }
예제 #6
0
        public Warrior RunSimulation()
        {
            Warrior light = null, dark = null;

            while ((light = LightSide.GetWarrior()) != null &&
                   (dark = DarkSide.GetWarrior()) != null)
            {
                light.PreCombatEffect();
                dark.PreCombatEffect();
                if (light.IsStrongerThan(dark))
                {
                    light.DecreasePower(dark.Power);
                    if (light.Power <= 0)
                    {
                        LightSide.KillWarrior();
                    }
                    DarkSide.KillWarrior();
                }
                else if (dark.IsStrongerThan(light))
                {
                    dark.DecreasePower(light.Power);
                    if (dark.Power <= 0)
                    {
                        DarkSide.KillWarrior();
                    }
                    LightSide.KillWarrior();
                }
                else
                {
                    LightSide.KillWarrior();
                    DarkSide.KillWarrior();
                }
                light.PostCombatEffect();
                dark.PostCombatEffect();
            }

            return(light ?? dark);
        }