示例#1
0
 /*************************************/
 public override void OnStateEnter(StateMachineMB.State from)
 {
     if (InTransit)
     {
         OwnerMB.StopCoroutine(_fade_out_thread);
         OwnerMB.StopCoroutine(_fade_in_thread);
         InTransit = false;
     }
     _fade_in_thread = FadeIn_Coroutine();
     OwnerMB.StartCoroutine(_fade_in_thread);
 }
        public override void OnUpdate()
        {
            // Laser SOURCE should always follow ship's slow movement, otherwise beam will freeze in space
            ((UFO)Owner)._laser.SetPosition(1, OwnerMB.transform.position);

            if (_has_fired)
            {
                return;
            }

            if ((Time.time - _time_started_charging) > UFO.CHARGING_TIME)
            {
                OwnerMB.StartCoroutine(Fire());
            }
        }
        public override void OnStateEnter(State from_state)
        {
            ((UFO)Owner).Speed = CHARGING_SPEED;

            ((UFO)Owner)._charging_flare_sprite.enabled = true;
            ((UFO)Owner)._charging_light.enabled        = true;
            ((UFO)Owner)._audio.pitch = UFO.CHARGING_PITCH;

            _time_started_charging = Time.time;
            _has_fired             = false;

#if DEVELOPMENT_BUILD
            if (CHARGING_TIME < TARGET_LOCK_TIME)
            {
                throw new UnityException("TARGET_LOCK_TIME must be less than CHARGING_TIME");
            }
#endif
            // Immediately acquire target lock, leading to firing
            OwnerMB.StartCoroutine(AcquireTargetLock());
        }
示例#4
0
 /*************************************/
 public override void OnStateExit(StateMachineMB.State to)
 {
     _fade_out_thread = FadeOut_Coroutine();
     OwnerMB.StartCoroutine(_fade_out_thread);
 }