コード例 #1
0
ファイル: Global.cs プロジェクト: alex-dmtr/Clash-of-Kings
    public static void SwitchToMenu()
    {
        if (CurrentGame != null)
            CurrentGame.gameObject.SetActive(false);

        State = GlobalStates.Menu;
    }
コード例 #2
0
ファイル: Global.cs プロジェクト: alex-dmtr/Clash-of-Kings
    public static void SwitchToGame()
    {
        if (CurrentGame == null)
            StartGame();

        State = GlobalStates.Playing;
        //CurrentGame.gameObject.SetActive(true);
    }
コード例 #3
0
    public void Init() // Use to init or reset script parameters
    {
        if (_fightersList.Count > 0)
        {
            for (int i = _fightersList.Count - 1; i >= 0; i--)
            {
                GameObject.Destroy(_fightersList[i]);
                _fightersList[i] = null;
                _fightersList.RemoveAt(i);
            }
        }
        if (_workersList.Count > 0)
        {
            for (int i = _curWorkersCount - 1; i >= 0; i--)
            {
                GameObject.Destroy(_workersList[i]);
                _workersList[i] = null;
                _workersList.RemoveAt(i);
            }
        }

        _THEGAMEScript = THEGAME.GetComponent <GlobalStates>();
        _gameScript    = _gamePanel.GetComponent <Game>();

        _state    = State.IDLE;
        resources = 1000;
        _timer    = 0.0f;

        _fighterStartState = Fighter.State.ORDERED;
        _maxFighters       = 5;
        _curFightersCount  = 0;
        _fighterOrderCost  = 120;
        _fighterOrderTime  = 10.0f;
        _fighterUpdateCost = 70;
        _fighterUpdateTime = 7.0f;
        _fighterMaxHP      = 20;
        _fighterUpdateHP   = 10;
        _fighterHealTime   = 3.0f;

        _workerStartState  = Worker.State.ORDERED;
        _maxWorkers        = 5;
        _curWorkersCount   = 0;
        _workerOrderCost   = 100;
        _workerOrderTime   = 5.0f;
        _mineValue         = 10;
        _mineTime          = 5.0f;
        _workersThreshHold = 3;
        _mineDecreaseValue = 1;

        Debug.Log("Base: Initialized Scene Script");
    }
コード例 #4
0
    // Use this for initialization
    void Start()
    {
        _player     = GameObject.Find("Player");
        myRigidbody = GetComponent <Rigidbody>();

        controlPoint = transform.position;
        destination  = transform.position;

        states    = GlobalStates.Roam;
        actStates = AttackStates.Wait;

        isPaused = false;

        animator.SetBool("Move", false);
        animator.SetInteger("Direction", 3);
    }
コード例 #5
0
        /// <summary>
        /// Adds a state to this state machine.  This function takes care of global states and ID checks.
        /// Should not really be used - instead use Character function 'CreateState' - it is much nicer and tidier.
        /// </summary>
        /// <param name="state"></param>
        public void CreateState(uint id, AnimationModule animation)
        {
            // This is a check to make sure that we are adding the states in the order they are declared in the enum.
            // If this doesn't occur, the states will be mixed up and all hell will break loose.
            Debug.Assert(id == currentAddedStates);

            State state = new State(id, animation);

            States[currentAddedStates] = state;
            currentAddedStates++;

            // If our state is global, add it to our list
            if (state.IsGlobal)
            {
                GlobalStates.Add(state);
            }
        }
コード例 #6
0
    public void Init()
    {
        _THEGAMEScript = THEGAME.GetComponent <GlobalStates>();
        _gameScript    = _gamePanel.GetComponent <Game>();
        _baseScript    = _basePanel.GetComponent <Base>();

        _fighters = new List <Fighter>();

        _enemyBaseDamage   = 1;
        _DamageIncrease    = 1;
        _roundsToIncrease  = 5;
        _enemiesCount      = 1;
        _currEnemiesCount  = _enemiesCount;
        _enemiesCurrDamage = _enemyBaseDamage;
        _currRound         = 0;

        Debug.Log("Combat: Initialized Scene Script");
    }
コード例 #7
0
ファイル: Global.cs プロジェクト: alex-dmtr/Clash-of-Kings
    public static void Initialize(GameObject GamePrefab)
    {
        Global.GamePrefab = GamePrefab;

        //pdapdateFromServer();
        //SQL.Initialize();

          //      SQL.ExecuteFile(@"SQL/Tables");
          //      SQL.ExecuteFile(@"SQL/CardTypes");
          //      SQL.ExecuteFile(@"SQL/Actions");
          //      SQL.ExecuteFile(@"SQL/Cards");
          //      SQL.ExecuteFile(@"SQL/Scenarios");
          //      SQL.ExecuteFile(@"SQL/LoadingScreens");
          //      SQL.ExecuteFile(@"SQL/Quotes");
          //      SQL.ExecuteFile(@"SQL/Classes");

        State = GlobalStates.Intro;
        //GameObject.Instantiate(GamePrefab);
    }
コード例 #8
0
    public void Init()
    {
        _THEGAMEScript = THEGAME.GetComponent <GlobalStates>();
        _combatScript  = _combatPanel.GetComponent <Combat>();
        _baseScript    = _basePanel.GetComponent <Base>();

        _doFightButton.GetComponent <Button>().interactable = false;

        GameTime        = 0;
        _tempTimer      = 0.0f;
        _delta          = 0.0f;
        _phase          = Phase.BASE;
        _basePhaseTime  = 20;
        _basePhaseTimer = _basePhaseTime;
        _round          = 0;
        _idleRounds     = 0;
        _isRoundIdle    = true;
        Debug.Log("Game: Initialized Scene Script");
    }
コード例 #9
0
    // Fonction qui gere le roaming de l'ennemi
    void Roam()
    {
        if ((Vector3.Distance(transform.position, destination) < 0.7f))
        {
            isPaused = true;
            if (timerRoam > timeBetweenRoam)
            {
                Vector3 point = Random.insideUnitSphere;
                point.y = 0;
                if (IsFree(controlPoint + (point.normalized * RoamRadius)))
                {
                    destination = controlPoint + (point.normalized * RoamRadius);
                    timerRoam   = 0;
                    isPaused    = false;
                    dontLook    = false;
                }
            }
            timerRoam += Time.deltaTime;
        }


        Collider[] targets = Physics.OverlapSphere(this.transform.position, distanceVision);

        foreach (Collider target in targets)
        {
            if (target.name == "Player")
            {
                Vector3 direction = _player.transform.position - transform.position;

                RaycastHit hit;
                if (Physics.Raycast(transform.position, direction.normalized, out hit, distanceVision))
                {
                    if (hit.collider.gameObject == _player)
                    {
                        states     = GlobalStates.Attack;
                        actStates  = AttackStates.Wait;
                        nextStates = AttackStates.GetCloser;
                    }
                }
            }
        }
    }
コード例 #10
0
ファイル: Tiger_Controller.cs プロジェクト: MrMesk/OnAir
    // Use this for initialization
    void Start()
    {
        _player = GameObject.Find("Player");
        myRigidbody = GetComponent<Rigidbody>();

        controlPoint = transform.position;
        destination = transform.position;

        states = GlobalStates.Roam;
        actStates = AttackStates.Wait;

        isPaused = false;

        normalColor = skin.GetComponent<Renderer>().material.color;

        animator.SetBool("Move", false);
        animator.SetInteger("Direction", 3);
    }
コード例 #11
0
ファイル: Tiger_Controller.cs プロジェクト: MrMesk/OnAir
    // Fonction qui gere le roaming de l'ennemi
    void Roam()
    {
        if ((Vector3.Distance(transform.position, destination) < 1.5f))
        {
            isPaused = true;
            if (timerRoam > timeBetweenRoam)
            {
                Vector3 point = Random.insideUnitSphere;
                point.y = 0;
                if (IsFree(controlPoint + (point.normalized * RoamRadius)))
                {
                    destination = controlPoint + (point.normalized * RoamRadius);
                    timerRoam = 0;
                    isPaused = false;
                    dontLook = false;
                }
            }
            timerRoam += Time.deltaTime;
        }

        Collider[] targets = Physics.OverlapSphere(this.transform.position, distanceVision);

        foreach (Collider target in targets)
        {
            if (target.name == "Player")
            {
                Vector3 direction = _player.transform.position - transform.position;

                RaycastHit hit;
                if (Physics.Raycast(transform.position, direction.normalized, out hit, distanceVision, visionMask))
                {
                    if (hit.collider.gameObject == _player)
                    {
                        states = GlobalStates.Attack;
                        actStates = AttackStates.Wait;
                        nextStates = AttackStates.GetCloser;
                    }
                }

            }
        }
    }
コード例 #12
0
 public State(int userId, GlobalStates globalState, int subStateId)
 {
     UserId      = userId;
     GlobalState = globalState;
     SubStateId  = subStateId;
 }