Пример #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="actionType"></param>
        public virtual void StartAction(GameActionTypeEnum actionType)
        {
            if (CurrentAction != null && CurrentAction.Type == actionType)
            {
                CurrentAction.Start();
            }

            switch (actionType)
            {
            case GameActionTypeEnum.MAP:
                Map.SpawnEntity(this);
                break;

            case GameActionTypeEnum.SKILL_HARVEST:
            case GameActionTypeEnum.MAP_MOVEMENT:
                MovementHandler.Dispatch(WorldMessage.GAME_ACTION(actionType, Id, CurrentAction.SerializeAs_GameAction()));
                break;

            case GameActionTypeEnum.MAP_TELEPORT:
                StopAction(GameActionTypeEnum.MAP);
                StopAction(GameActionTypeEnum.MAP_TELEPORT);
                // Switch back to world context
                WorldService.Instance.AddUpdatable(this);
                break;
            }
        }
        //return true unless we try to start an action and fail
        protected bool StartNextAction()
        {
            bool success = false;

            try
            {
                CurrentAction = NextAction();

                success = true;

                if (CurrentAction != null)
                {
                    CurrentAction.ActionCompletedEvent += this.ActionCompletedHandler;
                    success = CurrentAction.Start();

                    if (success)
                    {
                        OnActionStarted(CurrentAction);
                    }
                    else
                    {
                        AbortCurrentAction();
                    }
                }
            }
            catch
            {
                Debug.Fail("Failed to start action");
            }

            return(success);
        }
Пример #3
0
        /// <summary>
        /// Migration Wizard Part listens to the Wizard Action's Notifications.
        /// This is handler for those notifications
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void WizardAction_PropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            // If Notification is of Migration of a singleWorkitem
            if (e.PropertyName == MigrateWorkItemsAction.Passed ||
                e.PropertyName == MigrateWorkItemsAction.Failed ||
                e.PropertyName == MigrateWorkItemsAction.Warning)
            {
                // Then update teh counters
                UpdateCounters(e.PropertyName);
            }
            // else if Wizard Action state is changed and it is changed to either Success/Warning/Failed
            else if (String.CompareOrdinal(e.PropertyName, "State") == 0 &&
                     (CurrentAction.State == WizardActionState.Success ||
                      CurrentAction.State == WizardActionState.Failed ||
                      CurrentAction.State == WizardActionState.Stopped ||
                      CurrentAction.State == WizardActionState.Warning))
            {
                // then Update Status of MigrationPart(Counters/Flags etc)
                UpdateStatus(CurrentAction.State);

                CurrentAction.Dispose();

                // Change current Action to next action in queue
                m_currentWizardActionNumber++;
                NotifyPropertyChanged("IsMigrating");

                // If there is any action pending then start it else update the Migration Part's satte and update its description
                if (m_currentWizardActionNumber < WizardActions.Count)
                {
                    CurrentAction.Start();
                }
                else
                {
                    UpdateWizardActionState();
                    switch (MigrationState)
                    {
                    case WizardActionState.Success:

                        Description = Resources.MigrationSuccessfulText;
                        break;

                    case WizardActionState.Warning:
                        Description = "Work items were migrated successfully but with warnings.";
                        break;

                    case WizardActionState.Failed:
                        Description = "Some error occured during migration of work items.";
                        break;

                    default:
                        break;
                    }
                }
            }
        }
Пример #4
0
//		//internal repeat.
//		private void RepeatCurrentAction(){
//		}

        //advance the action to the next one.
        public void NextAction()
        {
            actionList.RemoveFirst();
//			Debug.Log("going to next action...");
            if (IsFinished)
            {
//				Debug.Log("no action! ending vignette.");
                return;
            }
            CurrentAction.Start();
        }
Пример #5
0
        /// <summary>
        /// Resets the Migration State
        /// </summary>
        public override void Reset()
        {
            // Only start the migration if it is active Wizard part and it is not already migrated
            if (IsActiveWizardPart && !m_isProcessed)
            {
                MigrationState = WizardActionState.InProgress;

                m_isProcessed = true;

                // Initialize All Wizard Actions which have to perform
                InitializeActions();

                // Start the First Action if it exists and sets the Description of the Wizard Part to be in progress
                if (WizardActions.Count > 0)
                {
                    CurrentAction.Start();
                    Description = Resources.MigrationInProgressText;
                }
            }
        }
Пример #6
0
    protected override void Update()
    {
        base.Update();

        //m_NavMeshAgent.destination = m_Player.transform.position;

        if (m_KingBoss.m_ShieldUp == true)
        {
            //  m_Shield.SetActive(true);
        }
        if (m_KingBoss.m_ShieldUp == false)
        {
            // m_Shield.SetActive(false);
        }

        ShowDebugStuff();

        // Enable the AI if the plater gets close
        if (GetDistanceToPlayer() < 50.0f && m_AiActive == false)
        {
            Services.GameManager.KingTriggered = true;
            m_AiActive = true;
            SetBehaviour((int)AIKingController.Behaviour.Offensive);
            SetAction((int)AIKingController.Action.None);
            m_MakeDecision = true;
        }

        // Enable the AI with button press
        if (Input.GetKeyDown("n"))
        {
            m_AiActive = true;
            SetBehaviour((int)AIKingController.Behaviour.Passive);
            SetAction((int)AIKingController.Action.Dodge);
            //SetNextAction((int)AIKingController.Action.DuelMove);
            // m_MakeDecision = true;
            //m_Animator.SetTrigger("t_Vertical_Swing");
        }

        // If the AI is active
        if (m_AiActive == true)
        {
            // If the player enters the pillars and the current beahviour isint pillar
            //if (m_LeftPillars.m_IsPlayerinside == true || m_RightPillars.m_IsPlayerinside == true && !IsCurrentAction((int)AIKingController.Behaviour.Pillar))
            //{
            //      // Change the behaviour to pillar
            //      SetBehaviour((int)AIKingController.Behaviour.Pillar);
            //}

            // If the Duel Behaviour is true and the behaviour isin't dueling
            if (m_IsDueling == true && !IsCurrentBehaviour((int)Behaviour.Dueling))
            {
                // Set Dueling to false and restart the Fire Circle cooldown
                m_IsDueling = false;
                FireCirlceCooldownTimer.Restart();
            }

            if (IsCurrentBehaviour((int)AIKingController.Behaviour.Offensive))
            {
                // If the king is walking
                if (IsCurrentAction((int)AIKingController.Action.Walk))
                {
                    // If the boss reaches melee range
                    if (GetDistanceToPlayer() < Constants.MeleeRange)
                    {
                        // Reset the walk and finish the action so the behaviour will choose the melee attack or continue walking
                        CurrentAction.Start();
                        CurrentBehaviour.OnActionFinished();
                    }
                }
            }

            // If the player and the king are in the center of the room
            if (m_RoomCenter.m_IsKingInside == true && m_RoomCenter.m_IsPlayerinside == true && m_IsDueling == false && FireCirlceCooldownTimer.IsFinished() && IsCurrentAction((int)AIKingController.Action.Walk))
            {
                // If the player is within range to start the duel
                if (GetDistanceToPlayer() < 15.0f && GetDistanceToPlayer() > 8.0f)
                {
                    // Set the action to summon fire circle and switch behaviour to dueling
                    SetBehaviour((int)AIKingController.Behaviour.Dueling);
                    SetAction((int)AIKingController.Action.FireCircle);
                    m_IsDueling = true;
                    FireCircleLengthTimer.Restart();
                }
            }
        }

        //// If the boss hit the player
        //if (m_HitPlayer == true)
        //{
        //    // Set hit to false so it only will be true for one frame
        //    m_HitPlayer = false;
        //}
    }
Пример #7
0
 public void SetCurrentActionAsNextAction()
 {
     CurrentAction = NextAction;
     CurrentAction.Start();
 }
Пример #8
0
 public void SetCurrentActionAsDecidedAction()
 {
     CurrentAction = DecidedAction;
     CurrentAction.Start();
 }
Пример #9
0
 public void StartAction()
 {
     CurrentAction.Start();
 }
Пример #10
0
 public void SetAction(int aAction)
 {
     CurrentAction = m_AIActions[aAction];
     CurrentAction.Start();
 }
Пример #11
0
        //restart the current action
        public void RestartCurrentAction()
        {
//			actionIndex--;
//			NextAction();
            CurrentAction.Start();
        }