Exemplo n.º 1
0
    private void Update()
    {
        if (life.getLife() <= 0)
        {
            if (!isDieing)
            {
                isDieing = true;
                animation.Play("Anim_Death");
                dieingSound.Play();
                deathParticles.SetActive(true);
                Destroy(gameObject, animation.clip.length);
            }
            return;
        }

        if (navMeshAgent.isStopped)
        {
            state = StateAI.Attacking;
            if (!animation.isPlaying)
            {
                animation.Play("Anim_Attack");
                playerLife.decreaseLife(attackPower * Time.deltaTime);
                attackSound.Play();
            }
        }
        else
        {
            state = StateAI.Walking;
            if (!animation.isPlaying)
            {
                animation.Play("Anim_Run");
            }
        }
    }
Exemplo n.º 2
0
    private void UpdateInformation()
    {
        //use it
        //state.regions[i].data.CalculateIncome(); - Доход провинции
        //state.army[i].GetUpkeep();
        StateAI ai = state.stateAI;

        allBudgetText.text = ai.treasury.ToString();
    }
Exemplo n.º 3
0
 public void SetState02(StateAI _state)
 {
     if (state02 != null)
     {
         state02.ExitAction();
     }
     state02 = _state;
     state02.EntryAction();
 }
Exemplo n.º 4
0
 public void SetState01(StateAI _state)
 {
     if (state01 != null)
     {
         state01.ExitAction();
     }
     state01 = _state;
     state01.EntryAction();
 }
Exemplo n.º 5
0
 public State()
 {
     regions   = new List <Region>();
     army      = new List <Army>();
     persons   = new List <Person>();
     ships     = new List <Ship>();
     regiments = new BaseRegiment[GameConst.MaxRegimentCount];
     GameObject.Instantiate(PrefabHandler.TechnologyTree).InitializeTree(this);
     stateAI = new StateAI(this);
     stateAI.IncomeResources(new Treasury(500, 2000, 100, 100, 20));
     GameTimer.AddListener(StateDecaSecondUpdate, this);
 }
Exemplo n.º 6
0
 void RunBrainStates()
 {
     currentState = FindState(stateName);
     if (currentState == null)
     {
         stateName     = "Not running any state...";
         stateDecision = "...";
         return;
     }
     stateName     = currentState.RunState();
     stateDecision = currentState.currentDecision;
 }
Exemplo n.º 7
0
    void Start()
    {
        agent = GetComponent <Agent>();
        animationController = GetComponent <AnimationController>();

        agent.SetSpeed(character.speed);

        print("employeeData.construct " + employeeData.construct);
        if (employeeData.construct != "")
        {
            targetObject = GameObject.Find(employeeData.construct);
        }

        current_StateAI  = AIAsset.instance.FindState(employeeData.stateAI);
        current_ActionAI = AIAsset.instance.FindAction(employeeData.actionAI);
    }
Exemplo n.º 8
0
 public AutoReasercher(StateAI state)
 {
     this.state     = state;
     technologyTree = state.Data.technologyTree;
 }
Exemplo n.º 9
0
 public AutoPersonControl(StateAI stateAI)
 {
     state = stateAI;
 }
Exemplo n.º 10
0
 public static void UpdateWantToTrade(StateAI state, List <(float, ResourcesType)> sortList)
Exemplo n.º 11
0
 public AutoDiplomacy(StateAI stateAI)
 {
     state = stateAI;
 }
Exemplo n.º 12
0
 public AutoBuilder(StateAI state)
 {
     this.state = state;
     provinces  = state.Data.regions;
 }
Exemplo n.º 13
0
 public AutoRegimentBuilder(StateAI aI)
 {
     (stateAI, RiskI, RiskII, RiskIII) = (aI, new HashSet <RegionProxi>(), new HashSet <RegionProxi>(), new HashSet <RegionProxi>());
     //CreateTemplates();
 }
Exemplo n.º 14
0
 public void TransitionToState(StateAI new_StateAI)
 {
     current_StateAI = new_StateAI;
 }