Start() public method

public Start ( ) : void
return void
Beispiel #1
0
        public void Update(float delta)
        {
            if (!IsRunning)
            {
                return;
            }

            if (IsComplete || _steps.Count < _currentIndex)
            {
                return;
            }

            if (!CurrentStep.IsComplete)
            {
                CurrentStep.Update(delta);
            }
            else
            {
                _currentIndex++;

                if (_currentIndex >= _steps.Count)
                {
                    IsComplete = true;
                }
                else
                {
                    CurrentStep.Start();
                    Update(delta);
                }
            }
        }
Beispiel #2
0
        private async Task <bool> ManageStepChangedAsync(Scene scene, string nextStep)
        {
            if (_currentStep != null)
            {
                _currentStep.Stop();
            }

            var step = scene.JumpToStep(nextStep);

            if (step == null)
            {
                Debug.WriteLine($"Attempted jump to step {nextStep} failed");
                return(false);
            }

            _currentStep = step;
            await _downlink.SendCloudToOtherdeviceMethodAsync(_currentStep.Commands);

            Debug.WriteLine($"ManageStepChangedAsync: {nextStep}");
            _currentStep.Start(OnStepExpired, scene.Participants);

            //We also need to send to each character the commands for the new step
            foreach (var kvp in Characters)
            {
                var character = kvp.Value;

                //Only characters that participate in AVA get commands back when a step changes
                if (character.IsRoaming)
                {
                    continue;
                }

                if (!character.Scenes.TryGetValue(CurrentSceneName, out CharacterScene sceneElement))
                {
                    continue;
                }

                if (null == sceneElement)
                {
                    continue;
                }

                if (null == sceneElement.Steps || !sceneElement.Steps.TryGetValue(nextStep, out AvaStep stepElement))
                {
                    continue;
                }

                if (null == stepElement)
                {
                    continue;
                }

                Debug.WriteLine($"Playing commands for: {kvp.Key}");
                await _downlink.SendCloudToLanternMethodAsync(character.LanternId, stepElement.Commands);
            }

            return(true);
        }
Beispiel #3
0
    void Action()
    {
        switch (player_status)
        {
        case Status.idle:
            isInvincible = false;
            rotation.Update(Input_dir);
            move.Update(Input_dir, isGrounded, isHit_against_theWall);
            gravity.Update(isGrounded);
            break;

        case Status.jumpping:
            gravity.Update(true);
            jump.Jumpping(this.transform);
            move.Update(Input_dir, false, isHit_against_theWall);
            rotation.Update(Input_dir);
            if (jump.isjumpping == false)
            {
                GetStatus(Status.idle);
            }
            break;

        case Status.guarding:
            damage.UPFukitobi(isHit_against_theWall);
            damage.SIDEFukitobi(isHit_against_theWall);
            if (guard.transitionProperty == Guard.Transition.Guarding)
            {
                if (Input_dir.magnitude != 0)
                {
                    guard.gobj.SetActive(false);
                    step.Start(Input_dir, true);
                    GetStatus(Status.stepping);
                    break;
                }
            }
            guard.Guarding();
            gravity.Update(isGrounded);
            if (guard.isGuarding == false)
            {
                GetStatus(Status.idle);
            }
            break;

        case Status.attacking:

            attack.Attacking();
            attack.isGrounded = isGrounded;
            if (attack.isAttacking == false)
            {
                GetStatus(Status.idle);
            }
            if (!isGrounded)
            {
                move.Update(Input_dir, false, isHit_against_theWall);
            }
            break;

        case Status.stepping:
            step.Stepping(isHit_against_theWall);
            isInvincible = step.invincibleProperty > 0 ? true : false;
            if (!step.isStepping)
            {
                GetStatus(Status.idle);
            }
            break;

        case Status.damaged:
            guard.gobj.SetActive(false);

            if (damage.Wait())
            {
                if (!isGrounded && Input.anyKeyDown)     //受身
                {
                    transform.localEulerAngles =
                        new Vector3
                            (transform.localEulerAngles.x,
                            transform.localEulerAngles.y, 0);

                    wait.Set(30, 0);
                    GetStatus(Status.waiting);
                }

                if (isGrounded && damage.UPFukitobi(isHit_against_theWall) && damage.SIDEFukitobi(isHit_against_theWall))
                {
                    wait.Set(40, 0);
                    wait.Waiting();
                    if (wait.Waiting() == true)
                    {
                        transform.localEulerAngles = new Vector3
                                                         (transform.localEulerAngles.x,
                                                         transform.localEulerAngles.y, 0);

                        GetStatus(Status.idle);
                    }
                }
            }
            else
            {
                wait.Set(3, 0);
                wait.Waiting();
                if (wait.Waiting() == true)
                {
                    isInvincible = false;
                }
                else
                {
                    isInvincible = true;
                }
            }
            damage.UPFukitobi(isHit_against_theWall);
            if (damage.UPFukitobi(isHit_against_theWall))
            {
                gravity.Update(isGrounded);
            }


            damage.SIDEFukitobi(isHit_against_theWall);


            break;

        case Status.waiting:
            wait.Waiting();
            if (wait.Waiting() == true)
            {
                GetStatus(Status.idle);
            }
            break;

        case Status.Down:
            this.gameObject.SetActive(false);
            break;
        }
    }
 public void StartStep(Step step)
 {
     currentStep = step;
     step.Start();
 }