Ejemplo n.º 1
0
        private void Start()
        {
            _ui = new UI.Core.UI();
            _forceCalculator = new ForceCalculator();
            _selector        = new Selector3D();
            _pusher          = new Pusher();
            _boardBuilder    = new BoardBuilder();
            _inputHandler    = new MouseInputHandler();

            _board        = _boardBuilder.Build();
            _turnSwitcher = new TurnSwitcher(_board);

            _playerAI = new PlayerAI(
                _inputHandler,
                _board
                );

            InitUIHandler();
            _inputHandler.OnDownEvent       += OnDownEventHandler;
            _inputHandler.OnUpEvent         += OnUpEventHandler;
            _turnSwitcher.MoveCompleteEvent += MoveCompleteEventHandler;
            _board.CheckersIsEmty           += CheckersIsEmtyEventHandler;

            foreach (var checker in _board.CheckersWhite.Concat(_board.CheckersBlack))
            {
                var checker1 = checker;
                checker1.SelectEvent         += () => SelectEventHandler(checker1);
                checker1.BouncingBorderEvent += () => BouncingBorderEventHandler(checker1);
            }

            _ui.SelectYourColourText();
        }
Ejemplo n.º 2
0
        public void UpdatePlayerAI(PlayerAI playerAI)
        {
            var entity = _playerAIRepository.GetFirst <Entities.PlayerAI>(ai => ai.AiId == playerAI.AiId);

            Mapper.Map(playerAI, entity);
            _playerAIRepository.SaveChanges();
        }
Ejemplo n.º 3
0
 public void AddPlayer(PlayerAI player, int index)
 {
     players.Add(player);
     player.onScoreChanged.AddListener(new UnityEngine.Events.UnityAction <int>((score) => UpdateScore(index, score)));
     scores[index].color = player.color;
     scores[index].text  = 0.ToString();
 }
Ejemplo n.º 4
0
 public Player(ClientConnection connection, CharacterData characterData) : base(ObjectFamily.Player)
 {
     Connection            = connection;
     DatabaseCharacterData = characterData;
     Position = new Position(new Vector3(characterData.PositionX, characterData.PositionY, characterData.PositionZ));
     Ai       = new PlayerAI(this, CfgCore.Default.VisibleRangeDistance);
 }
Ejemplo n.º 5
0
    void Awake()
    {
        Debug.Assert(instance == null);
        instance = this;

        foreach (GamePiece p in piecePrefabs)
        {
            p.SmoothMeshNormals();
        }

        Color oldColor = ghostMaterial.color;

        ghostMaterial.color = new Color(oldColor.r, oldColor.g, oldColor.b, ghostAlpha);

        gamePieces       = new GamePiece[64];
        whitePiecesTaken = new GamePiece[15];
        blackPiecesTaken = new GamePiece[15];
        highlights       = new GameObject[64];
        foreach (Square s in Square.squares)
        {
            GameObject highlight = Instantiate(highlightPrefab, GetSquareCenter(s) + highlightHeight * tileUp, Quaternion.AngleAxis(90f, Vector3.right), boardObject.transform);
            highlight.transform.localScale  = new Vector3(tileSize, tileSize, tileSize);
            highlights[8 * s.rank + s.file] = highlight;
        }
        Reset();

#if UNITY_WEBGL || UNITY_EDITOR
        playerAI       = gameObject.AddComponent <PlayerAI>();
        playerAI.color = PieceColor.Black;
#else
        playerAI = new PlayerAI(PieceColor.Black);
#endif
    }
Ejemplo n.º 6
0
    PlayerAI getPlayerAI()
    {
        GameObject player = GameObject.FindGameObjectWithTag("Player");
        PlayerAI   ai     = player.GetComponent("PlayerAI") as PlayerAI;

        return(ai);
    }
Ejemplo n.º 7
0
    // Update is called once per frame
    void Update()
    {
        transform.localPosition   += moveDirection * Time.deltaTime * MeatBehaviour.Speed;
        timeToChangeMoveDirection -= Time.deltaTime;
        if (terrain == null)
        {
            GameObject go = GameObject.Find("Tile Map");
            if (go != null)
            {
                terrain = go.GetComponent <PATileTerrain>();
            }
        }

        PlayerAI ai        = getPlayerAI();
        Vector3  direction = ai.transform.localPosition - transform.localPosition;

        direction.y = 0;

        if (direction.sqrMagnitude <= MeatBehaviour.SightDistance * MeatBehaviour.SightDistance)
        {
            this.attackObject(ai.gameObject, direction.normalized, direction.sqrMagnitude);
        }
        else if (timeToChangeMoveDirection <= 0)
        {
            changeMoveDirection();
        }
        else if (transform.localPosition.x <= 0 || transform.localPosition.x >= terrain.width ||
                 transform.localPosition.z <= 0 || transform.localPosition.z >= terrain.height)
        {
            moveDirection            *= -1;
            timeToChangeMoveDirection = changeInterval;
        }
    }
Ejemplo n.º 8
0
    public void Initilaize(PlayerAI t_playerAI, City t_city)
    {
        m_city     = t_city;
        m_playerAI = t_playerAI;

        m_randomDelay = Random.Range(5, 10);
    }
    public override void Act(PlayerAI jetFighter)
    {
        if (focusEnemy == null)
        {
            jetFighter.jet.isShooting = false;

            if (jetFighter.liveEnemies.Count > 0)
            {
                focusEnemy = jetFighter.liveEnemies[0];
            }
        }
        else
        {
            jetFighter.targetPosition = focusEnemy.transform.localPosition;

            if (transform.localPosition.x > jetFighter.targetPosition.x + jetFighter.positionLimitX)
            {
                jetFighter.jet.isShooting = false;
                jetFighter.jet.velocity  -= new Vector2(1, 0) * Time.deltaTime * jetFighter.acc;
            }
            else if (transform.localPosition.x < jetFighter.targetPosition.x - jetFighter.positionLimitX)
            {
                jetFighter.jet.isShooting = false;
                jetFighter.jet.velocity  += new Vector2(1, 0) * Time.deltaTime * jetFighter.acc;
            }
            else
            {
                jetFighter.jet.isShooting = true;
            }
        }
    }
Ejemplo n.º 10
0
    void OnGUI()
    {
        PlayerAI ai            = this.getPlayerAI();
        string   score_content = "Mutation points: <b>" + ai.points + "</b>";

        button_width = (int)(camera.pixelWidth - 83 - 4 * padding - 60) / 10;
        if (button_width > 25)
        {
            button_width = 25;
        }

        GUILayout.BeginArea(new Rect(padding * 2, padding, camera.pixelWidth, control_start));
        GUILayout.Label(score_content, header_style);
        GUILayout.EndArea();

        createStat(0, "fangs");
        createStat(1, "incisors");
        createStat(2, "hands");
        createStat(3, "legs");
        createStat(4, "brain");
        createStat(5, "eyes");
        createStat(6, "nose");
        createStat(7, "liver");

        GUI.Label(new Rect(padding, camera.pixelHeight - 150 - padding, 80, 40), "Meat: " + ai.meatDesire);
        GUI.Label(new Rect(padding, camera.pixelHeight - 150 - padding - padding - 40, 80, 40), "Plant: " + ai.plantDesire);
        GUI.Label(new Rect(padding, camera.pixelHeight - 150 - padding - (padding + 40) * 2, 80, 40), "Alc: " + ai.alcoholDesire);
        GUI.Label(new Rect(padding, camera.pixelHeight - 120 - padding, 80, 40), "Helath: " + ai.health + "/" + ai.maxHealth);
        GUI.Label(new Rect(padding, camera.pixelHeight - 90 - padding, 80, 40), "Poison: " + ai.poisoning);

        GUI.DrawTexture(new Rect(camera.pixelWidth - 80 - padding, camera.pixelHeight - 80 - padding, 80, 80), updateHealthTexture());
    }
Ejemplo n.º 11
0
        public override void Update()
        {
            var ballMap = Game.GameManager.Navigation.PotentialMaps["BallMap"];

            if (PlayerAI.Player.Ball != null)
            {
                var target = Game.GameManager.Players[0];
                var dir    = target.Position - PlayerAI.Position;

                PlayerAI.AimAtPosition(target.Position);

                if (!PlayerAI.Player.IsShotCharging)
                {
                    PlayerAI.StartShotCharge();
                }

                if (PlayerAI.Player.IsShotCharged)
                {
                    PlayerAI.ShootCharged(dir);
                }
            }
            else if (Game.GameManager.Ball != null && Game.GameManager.Ball.Player == null)
            {
                PlayerAI.NavigateToBall();
            }
        }
Ejemplo n.º 12
0
    protected override void Awake()
    {
        if (instance)
        {
            Destroy(instance.gameObject);
        }
        instance = this;

        base.Awake();
        hp              = playerEntity.maxHp;
        moveSpeed       = playerEntity.speed;
        jumpForce       = playerEntity.jumpForce;
        airControl      = playerEntity.airControl;
        wallJumpUpForce = playerEntity.wallJumpUpForce;
        if (wallJumpUpForce > 0)
        {
            wallJumpSideForce = playerEntity.wallJumpSideForce;
        }

        controls = new Controls();
        controls.Player.Jump.performed     += ctx => JumpPressed();
        controls.Player.Attack.performed   += ctx => AttackPressed();
        controls.Player.Interact.performed += ctx => InteractPressed();

        attackRotation = transform.Find("attackRotation");
        attackPos      = attackRotation.Find("attackPos");
    }
Ejemplo n.º 13
0
 public SecondMapFactory()
 {
     mapType = MapType.DataMap;
     width = 12;
     height = 7;
     initial_silicoins = 600;
     total_spawn_weight = 30;
     player1 = GlobalAccessors.mPlayer1;
     player2 = new PlayerAI("AI");
     player1_spawns = new List<Point>();
     player2_programs = new List<Tuple<ProgramFactory, Point, IEnumerable<Point>>>();
     player1_spawns.Add(new Point(0, 1));
     player1_spawns.Add(new Point(0, 3));
     player1_spawns.Add(new Point(0, 5));
     WatcherFactory watcherFactory = new WatcherFactory();
     AddPlayer2Program(watcherFactory, new Point(4, 0));
     AddPlayer2Program(watcherFactory, new Point(7, 0));
     AddPlayer2Program(watcherFactory, new Point(4, 6));
     AddPlayer2Program(watcherFactory, new Point(7, 6));
     unavailableNodes = new List<Point>();
     unavailableNodes.Add(new Point(3, 0));
     unavailableNodes.Add(new Point(3, 1));
     unavailableNodes.Add(new Point(3, 2));
     unavailableNodes.Add(new Point(3, 3));
     unavailableNodes.Add(new Point(3, 4));
     unavailableNodes.Add(new Point(3, 5));
     unavailableNodes.Add(new Point(3, 6));
     unavailableNodes.Add(new Point(4, 1));
     unavailableNodes.Add(new Point(4, 2));
     unavailableNodes.Add(new Point(4, 3));
     unavailableNodes.Add(new Point(4, 4));
     unavailableNodes.Add(new Point(4, 5));
     unavailableNodes.Add(new Point(5, 1));
     unavailableNodes.Add(new Point(5, 2));
     unavailableNodes.Add(new Point(5, 3));
     unavailableNodes.Add(new Point(5, 4));
     unavailableNodes.Add(new Point(5, 5));
     unavailableNodes.Add(new Point(6, 1));
     unavailableNodes.Add(new Point(6, 2));
     unavailableNodes.Add(new Point(6, 3));
     unavailableNodes.Add(new Point(6, 4));
     unavailableNodes.Add(new Point(6, 5));
     unavailableNodes.Add(new Point(7, 1));
     unavailableNodes.Add(new Point(7, 2));
     unavailableNodes.Add(new Point(7, 3));
     unavailableNodes.Add(new Point(7, 4));
     unavailableNodes.Add(new Point(7, 5));
     unavailableNodes.Add(new Point(8, 0));
     unavailableNodes.Add(new Point(8, 1));
     unavailableNodes.Add(new Point(8, 2));
     unavailableNodes.Add(new Point(8, 3));
     unavailableNodes.Add(new Point(8, 4));
     unavailableNodes.Add(new Point(8, 5));
     unavailableNodes.Add(new Point(8, 6));
     silicoinNodes.Add(new Point(5, 0), 100);
     silicoinNodes.Add(new Point(6, 0), 50);
     silicoinNodes.Add(new Point(5, 6), 75);
     silicoinNodes.Add(new Point(6, 6), 25);
     dataNodes.Add(new Point(10, 3));
 }
Ejemplo n.º 14
0
        public int CreatePlayerAI(PlayerAI playerAI)
        {
            var entity = Mapper.Map <Entities.PlayerAI>(playerAI);

            _playerAIRepository.Add(playerAI);
            _playerAIRepository.SaveChanges();
            return(entity.AiId);
        }
Ejemplo n.º 15
0
 public void Init()
 {
     for (int iPlayer = 0; iPlayer < tPlayer.Length; ++iPlayer)
     {
         tPlayer[iPlayer] = new PlayerAI();
         tPlayer[iPlayer].Init(new FormationPos(EPosition.DCM));
     }
 }
Ejemplo n.º 16
0
 public void PlayerDeath(PlayerAI ai, bool isLeader)
 {
     playerAI.Remove(ai);
     if (controlledAI != 0)
     {
         controlledAI--;
     }
 }
Ejemplo n.º 17
0
 public void SetPlayerAI(PlayerAI tAI)
 {
     m_tAI = tAI;
     if (m_tAI != null)
     {
         m_tAI.SetPosition(Formation.GetPosition(m_tAI.GetFormationPos().ePos, m_tAI.IsHome()));
     }
 }
Ejemplo n.º 18
0
 private void AimAndPass(Vector2 position)
 {
     PlayerAI.AimAtPosition(position);
     if (PlayerAI.IsAimingAtPosition(position))
     {
         PlayerAI.Pass(PlayerAI.GetAim());
     }
 }
Ejemplo n.º 19
0
 // Use this for initialization
 void Start()
 {
     player       = GameObject.FindGameObjectWithTag("Player");
     playerAI     = player.GetComponent <PlayerAI>();
     cameraManage = GameObject.FindGameObjectWithTag("CameraManagement").GetComponent <CameraManagement>();
     pickUp       = LayerMask.GetMask("Pickup");
     NPCMask      = LayerMask.GetMask("NPC");
 }
Ejemplo n.º 20
0
    PlayerAI MakeNewPlayerAI()
    {
        GameObject new_player = Instantiate(playerPrefab, SpawnPoint);
        PlayerAI   playerAI   = new_player.GetComponent <PlayerAI>();

        new_player.GetComponent <PlayerScript>().Spawn = SpawnPoint.gameObject;
        return(playerAI);
    }
Ejemplo n.º 21
0
    void Init()
    {
        //玩家属性
        player_characrer = GetComponent <PlayerCharacter> ();
        if (player_characrer == null)
        {
            player_characrer = gameObject.AddComponent <PlayerCharacter> ();
        }

        //玩家生命魔法
        player_health = GetComponent <PlayerHealth> ();
        if (player_health == null)
        {
            player_health = gameObject.AddComponent <PlayerHealth> ();
        }
        player_health.deathDelegate = new Callback(Death);

        //玩家攻击受击
        player_attack = GetComponent <PlayerAttack> ();
        if (player_attack == null)
        {
            player_attack = gameObject.AddComponent <PlayerAttack> ();
        }

        //玩家AI
        player_AI = GetComponent <PlayerAI> ();
        if (player_AI == null)
        {
            player_AI = gameObject.AddComponent <PlayerAI> ();
        }
        player_AI.activeAI = false;

        //搜索敌人
        seclectTarget = GetComponent <SeclectTargetting> ();
        if (seclectTarget == null)
        {
            seclectTarget = gameObject.AddComponent <SeclectTargetting> ();
        }

        //动画管理器
        animator = GetComponent <Animator> ();
        if (animator == null)
        {
            Debug.LogError("PlayerController Init Error Animator is Null");
        }

        //Animator HashIDs
        hashIDs = GetComponent <AnimatorHashIDs>();
        if (hashIDs = null)
        {
            hashIDs = gameObject.AddComponent <AnimatorHashIDs>();
        }

        //玩家状态机
        player_fsm = new PlayerFSM();
        player_fsm.start(this);
        player_fsm.change(PlayerFSMStandState.STATE_NAME);
    }
Ejemplo n.º 22
0
    private void Processor2PlayCard()
    {
        if (mPlayCard == null)
        {
            mPlayCard = new PlayCard();
        }
        Player   playPlayer   = mPlayCard.player.GetComponent <Player>();;
        PlayerAI playPlayerAI = mPlayCard.player.GetComponent <PlayerAI>();

        //出牌
        if (mPlayCard.cardDataListToPlayer == null || mPlayCard.player == mPlayCard.cardDataListToPlayer)
        {
            if (playPlayer != null)
            {
                Debug.LogError("出牌:" + playPlayer.gameObject);
                playPlayer.PlayCardInit();
                playPlayer.mPlay.SetActive(true);
            }
            else if (playPlayerAI != null)
            {
                Debug.LogError("出牌:" + playPlayerAI.gameObject);
                playPlayerAI.mPass.SetActive(false);
                for (int i = 0; i < playPlayerAI.mCardList.Count; i++)
                {
                    playPlayerAI.mCardList[i].gameObject.SetActive(false);
                }
                playPlayerAI.SetTime(true);
                mTimerTask.Add(TimeManage.Instance.AddTimerTask(playPlayerAI.Play, Random.Range(1.4f, 3.4f)));
            }
        }
        else//打牌
        {
            if (playPlayer != null)
            {
                Debug.LogError("打牌:" + playPlayer.gameObject);
                playPlayer.PlayCardInit();
                if (CardArithmetic.AutoPlay(mCombatView.mPlayer.mCardData, mPlayCard) == null)
                {
                    playPlayer.mPass.SetActive(true);
                }
                else
                {
                    playPlayer.mAct.SetActive(true);
                }
            }
            else if (playPlayerAI != null)
            {
                Debug.LogError("打牌:" + playPlayerAI.gameObject);
                playPlayerAI.mPass.SetActive(false);
                for (int i = 0; i < playPlayerAI.mCardList.Count; i++)
                {
                    playPlayerAI.mCardList[i].gameObject.SetActive(false);
                }
                playPlayerAI.SetTime(true);
                mTimerTask.Add(TimeManage.Instance.AddTimerTask(playPlayerAI.HitPlay, Random.Range(1.4f, 3.4f)));
            }
        }
    }
Ejemplo n.º 23
0
    public float Fitness(PlayerAI child)
    {
        float return_fit = 0;

        //one distance factor playing into the solution
        return_fit += (float)child.ChromosomeLength / BestSoFar.ChromosomeLength;

        return(return_fit);
    }
Ejemplo n.º 24
0
 public void Awake()
 {
     base.BaseAwake();
     player = GetComponent <PlayerAI>();
     NetworkManager._Instance.AddCallBack(4, GetNetworkMsgCallBack);
     NetworkManager._Instance.AddCallBack(5, GetNetworkMsgCallBack);
     NetworkManager._Instance.AddCallBack(6, GetNetworkMsgCallBack);
     NetworkManager._Instance.AddCallBack(18, GetNetworkMsgCallBack);
 }
Ejemplo n.º 25
0
    public static void Detect()
    {
        Point[] pcArr = pc.ToArray();

        Gesture g = new Gesture(pc.ToArray());

        PlayerAI.DetectSpell(g, PlayerAI.loadedGestures.ToArray());

        Clear();
    }
Ejemplo n.º 26
0
 private void Awake()
 {
     player             = playerGO.GetComponent <PlayerStats>();
     cpu                = cpuGO.GetComponent <PlayerStats>();
     skillManagerPlayer = playerGO.GetComponent <SkillManager>();
     skillManagerCpu    = cpuGO.GetComponent <SkillManager>();
     turn               = gameObject.GetComponent <Turn>();
     enemyAI            = cpuGO.GetComponent <EnemyAI>();
     playerAI           = playerGO.GetComponent <PlayerAI>();
 }
Ejemplo n.º 27
0
    bool canUpgradeStatWithCost(int cost)
    {
        PlayerAI ai = this.getPlayerAI();

        if (ai.points >= cost)
        {
            return(true);
        }
        return(false);
    }
Ejemplo n.º 28
0
    PlayerAI MakeNewPlayerAI(List <int> Chromo)
    {
        GameObject new_player = Instantiate(playerPrefab, SpawnPoint);
        PlayerAI   playerAI   = new_player.GetComponent <PlayerAI>();

        playerAI.fitness    = Fitness(Chromo);
        playerAI.Chromosome = Chromo;
        new_player.GetComponent <PlayerScript>().Spawn = SpawnPoint.gameObject;
        return(playerAI);
    }
Ejemplo n.º 29
0
    private void MoveSelectedUnit(PlayerAI selectedPlayer)
    {
        Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
        RaycastHit hit;

        if (Physics.Raycast(ray, out hit))
        {
            selectedPlayer.MoveTo(hit.point);
            MoveRemainingUnits(hit.point, controlledAI);
        }
    }
Ejemplo n.º 30
0
    void SurvivalSelection()
    {
        ResetAllChildren();
        //Survival selection!
        Generation += 1;

        // n = calc how many children to remove from pop (always even)
        // remove n worst members of the pop
        // let's go with quarter pop removal
        var quarterPop = Population.Count / 4;

        for (int i = quarterPop * 3; i < Population.Count; i++)
        {
            PlayerAI tempPlayer = Population[i];
            DiscardedChildren.Enqueue(tempPlayer);
        }
        Population.RemoveRange(quarterPop * 3, quarterPop);


        List <PlayerAI> tempChildren = new List <PlayerAI>();

        // select parents from the remaining pool and make n children
        for (int i = 0; i < quarterPop / 2; i++)
        {
            PlayerAI[] parents  = TournamentSelection(Population, Population.Count / 2);
            PlayerAI[] children = Crossover(parents);

            foreach (var child in children)
            {
                // should we mutate?
                if (random.NextDouble() <= MutationRate)
                {
                    child.Chromosome = Mutation(child.Chromosome);
                }
                child.fitness = Fitness(child);

                // removed children get replaced with the new children
                tempChildren.Add(child);
            }
        }

        foreach (var child in tempChildren)
        {
            Population.Add(child);
        }
        Population = Population.OrderByDescending(p => p.fitness).ToList();

        GameState = GAMESTATE.RUNNING;
        //Done with Survival Selection
        foreach (var child in Population)
        {
            child.StartPlayerAI();
        }
    }
Ejemplo n.º 31
0
    /* Kills the unit. */
    public override void Die()
    {
        if (PlayerAI.targetToAttack == transform)
        {
            PlayerAI.DeselectTarget();
        }
        GetComponent <SteerableUnitComponent>().Stop();
        GetComponent <UnitAnimator>().Die();

        DisableComponents();
    }
Ejemplo n.º 32
0
 public ThirdMapFactory()
 {
     mapType = MapType.EnemyMap;
     width = 20;
     height = 10;
     initial_silicoins = 1000;
     total_spawn_weight = 100;
     player1 = GlobalAccessors.mPlayer1;
     player2 = new PlayerAI("AI");
     player1_spawns = new List<Point>();
     player2_programs = new List<Tuple<ProgramFactory, Point, IEnumerable<Point>>>();
     player1_spawns.Add(new Point(0, 2));
     player1_spawns.Add(new Point(0, 3));
     player1_spawns.Add(new Point(0, 6));
     player1_spawns.Add(new Point(0, 7));
     SwarmerFactory swarmerFactory = new SwarmerFactory();
     AddPlayer2Program(swarmerFactory, new Point(19, 1));
     AddPlayer2Program(swarmerFactory, new Point(19, 2));
     AddPlayer2Program(swarmerFactory, new Point(19, 4));
     AddPlayer2Program(swarmerFactory, new Point(19, 5));
     AddPlayer2Program(swarmerFactory, new Point(19, 7));
     AddPlayer2Program(swarmerFactory, new Point(19, 8));
     unavailableNodes = new List<Point>();
     unavailableNodes.Add(new Point(3, 3));
     unavailableNodes.Add(new Point(3, 4));
     unavailableNodes.Add(new Point(3, 5));
     unavailableNodes.Add(new Point(3, 6));
     unavailableNodes.Add(new Point(7, 2));
     unavailableNodes.Add(new Point(6, 1));
     unavailableNodes.Add(new Point(5, 0));
     unavailableNodes.Add(new Point(5, 9));
     unavailableNodes.Add(new Point(6, 8));
     unavailableNodes.Add(new Point(7, 7));
     unavailableNodes.Add(new Point(9, 4));
     unavailableNodes.Add(new Point(9, 5));
     unavailableNodes.Add(new Point(10, 4));
     unavailableNodes.Add(new Point(10, 5));
     unavailableNodes.Add(new Point(16, 3));
     unavailableNodes.Add(new Point(16, 4));
     unavailableNodes.Add(new Point(16, 5));
     unavailableNodes.Add(new Point(16, 6));
     unavailableNodes.Add(new Point(12, 2));
     unavailableNodes.Add(new Point(13, 1));
     unavailableNodes.Add(new Point(13, 0));
     unavailableNodes.Add(new Point(12, 7));
     unavailableNodes.Add(new Point(13, 8));
     unavailableNodes.Add(new Point(14, 9));
 }
Ejemplo n.º 33
0
 public FirstMapFactory()
 {
     mapType = MapType.EnemyMap;
     width = 7;
     height = 7;
     initial_silicoins = 500;
     total_spawn_weight = 20;
     player1 = GlobalAccessors.mPlayer1;
     player2 = new PlayerAI("AI");
     player1_spawns = new List<Point>();
     player2_programs = new List<Tuple<ProgramFactory, Point, IEnumerable<Point>>>();
     player1_spawns.Add(new Point(0, 2));
     player1_spawns.Add(new Point(0, 4));
     AddPlayer2Program(new SentryFactory(), new Point(6, 3));
     unavailableNodes = new List<Point>();
     unavailableNodes.Add(new Point(3, 2));
     unavailableNodes.Add(new Point(2, 3));
     unavailableNodes.Add(new Point(3, 3));
     unavailableNodes.Add(new Point(4, 3));
     unavailableNodes.Add(new Point(3, 4));
 }
Ejemplo n.º 34
0
 public FourthMapFactory()
 {
     mapType = MapType.DataMap;
     width = 10;
     height = 10;
     initial_silicoins = 900;
     total_spawn_weight = 40;
     player1 = GlobalAccessors.mPlayer1;
     player2 = new PlayerAI("AI");
     player1_spawns = new List<Point>();
     player2_programs = new List<Tuple<ProgramFactory, Point, IEnumerable<Point>>>();
     player1_spawns.Add(new Point(0, 9));
     SwarmerFactory swarmerFactory = new SwarmerFactory();
     AddPlayer2Program(swarmerFactory, new Point(2, 8));
     AddPlayer2Program(swarmerFactory, new Point(6, 4));
     AddPlayer2Program(swarmerFactory, new Point(6, 6));
     WatcherFactory watcherFactory = new WatcherFactory();
     AddPlayer2Program(watcherFactory, new Point(2, 3));
     AddPlayer2Program(watcherFactory, new Point(4, 4));
     AddPlayer2Program(watcherFactory, new Point(6, 1));
     unavailableNodes = new List<Point>();
     unavailableNodes.Add(new Point(1, 1));
     unavailableNodes.Add(new Point(1, 2));
     unavailableNodes.Add(new Point(1, 3));
     unavailableNodes.Add(new Point(1, 4));
     unavailableNodes.Add(new Point(1, 5));
     unavailableNodes.Add(new Point(1, 6));
     unavailableNodes.Add(new Point(1, 7));
     unavailableNodes.Add(new Point(1, 8));
     unavailableNodes.Add(new Point(1, 9));
     unavailableNodes.Add(new Point(2, 9));
     unavailableNodes.Add(new Point(3, 0));
     unavailableNodes.Add(new Point(3, 1));
     unavailableNodes.Add(new Point(3, 3));
     unavailableNodes.Add(new Point(3, 4));
     unavailableNodes.Add(new Point(3, 5));
     unavailableNodes.Add(new Point(3, 6));
     unavailableNodes.Add(new Point(3, 7));
     unavailableNodes.Add(new Point(3, 9));
     unavailableNodes.Add(new Point(4, 3));
     unavailableNodes.Add(new Point(4, 7));
     unavailableNodes.Add(new Point(5, 1));
     unavailableNodes.Add(new Point(5, 2));
     unavailableNodes.Add(new Point(5, 3));
     unavailableNodes.Add(new Point(5, 4));
     unavailableNodes.Add(new Point(5, 5));
     unavailableNodes.Add(new Point(5, 7));
     unavailableNodes.Add(new Point(5, 9));
     unavailableNodes.Add(new Point(6, 2));
     unavailableNodes.Add(new Point(6, 5));
     unavailableNodes.Add(new Point(6, 9));
     unavailableNodes.Add(new Point(7, 0));
     unavailableNodes.Add(new Point(7, 2));
     unavailableNodes.Add(new Point(7, 3));
     unavailableNodes.Add(new Point(7, 5));
     unavailableNodes.Add(new Point(7, 6));
     unavailableNodes.Add(new Point(7, 7));
     unavailableNodes.Add(new Point(7, 8));
     unavailableNodes.Add(new Point(7, 9));
     unavailableNodes.Add(new Point(8, 0));
     unavailableNodes.Add(new Point(8, 6));
     unavailableNodes.Add(new Point(9, 2));
     unavailableNodes.Add(new Point(9, 3));
     unavailableNodes.Add(new Point(9, 4));
     unavailableNodes.Add(new Point(9, 8));
     unavailableNodes.Add(new Point(9, 9));
     silicoinNodes.Add(new Point(4, 9), 100);
     silicoinNodes.Add(new Point(6, 3), 100);
     silicoinNodes.Add(new Point(9, 0), 100);
     dataNodes.Add(new Point(8, 9));
 }
Ejemplo n.º 35
0
 public SixthMapFactory()
 {
     mapType = MapType.EnemyMap;
     width = 11;
     height = 11;
     initial_silicoins = 2000;
     total_spawn_weight = 100;
     player1 = GlobalAccessors.mPlayer1;
     player2 = new PlayerAI("AI");
     player1_spawns = new List<Point>();
     player2_programs = new List<Tuple<ProgramFactory, Point, IEnumerable<Point>>>();
     player1_spawns.Add(new Point(0, 3));
     player1_spawns.Add(new Point(0, 4));
     player1_spawns.Add(new Point(0, 5));
     player1_spawns.Add(new Point(0, 6));
     player1_spawns.Add(new Point(0, 7));
     SantaFactory santaFactory = new SantaFactory();
     Point[] santaTailNodes = new Point[24];
     santaTailNodes[0] = new Point(7, 5);
     santaTailNodes[1] = new Point(8, 5);
     santaTailNodes[2] = new Point(8, 6);
     santaTailNodes[3] = new Point(7, 6);
     santaTailNodes[4] = new Point(6, 6);
     santaTailNodes[5] = new Point(6, 7);
     santaTailNodes[6] = new Point(7, 7);
     santaTailNodes[7] = new Point(8, 7);
     santaTailNodes[8] = new Point(9, 7);
     santaTailNodes[9] = new Point(9, 6);
     santaTailNodes[10] = new Point(9, 5);
     santaTailNodes[11] = new Point(9, 4);
     santaTailNodes[12] = new Point(8, 4);
     santaTailNodes[13] = new Point(7, 4);
     santaTailNodes[14] = new Point(6, 4);
     santaTailNodes[15] = new Point(6, 3);
     santaTailNodes[16] = new Point(7, 3);
     santaTailNodes[17] = new Point(8, 3);
     santaTailNodes[18] = new Point(9, 3);
     santaTailNodes[19] = new Point(10, 3);
     santaTailNodes[20] = new Point(10, 4);
     santaTailNodes[21] = new Point(10, 5);
     santaTailNodes[22] = new Point(10, 6);
     santaTailNodes[23] = new Point(10, 7);
     AddPlayer2Program(santaFactory, new Point(6, 5), santaTailNodes);
     unavailableNodes = new List<Point>();
     unavailableNodes.Add(new Point(0, 0));
     unavailableNodes.Add(new Point(1, 0));
     unavailableNodes.Add(new Point(2, 0));
     unavailableNodes.Add(new Point(8, 0));
     unavailableNodes.Add(new Point(9, 0));
     unavailableNodes.Add(new Point(10, 0));
     unavailableNodes.Add(new Point(0, 1));
     unavailableNodes.Add(new Point(1, 1));
     unavailableNodes.Add(new Point(9, 1));
     unavailableNodes.Add(new Point(10, 1));
     unavailableNodes.Add(new Point(0, 2));
     unavailableNodes.Add(new Point(10, 2));
     unavailableNodes.Add(new Point(5, 5));
     unavailableNodes.Add(new Point(0, 8));
     unavailableNodes.Add(new Point(10, 8));
     unavailableNodes.Add(new Point(0, 9));
     unavailableNodes.Add(new Point(1, 9));
     unavailableNodes.Add(new Point(9, 9));
     unavailableNodes.Add(new Point(10, 9));
     unavailableNodes.Add(new Point(0, 10));
     unavailableNodes.Add(new Point(1, 10));
     unavailableNodes.Add(new Point(2, 10));
     unavailableNodes.Add(new Point(8, 10));
     unavailableNodes.Add(new Point(9, 10));
     unavailableNodes.Add(new Point(10, 10));
 }
Ejemplo n.º 36
0
 public FifthMapFactory()
 {
     mapType = MapType.EnemyMap;
     width = 16;
     height = 13;
     initial_silicoins = 1500;
     total_spawn_weight = 80;
     player1 = GlobalAccessors.mPlayer1;
     player2 = new PlayerAI("AI");
     player1_spawns = new List<Point>();
     player2_programs = new List<Tuple<ProgramFactory, Point, IEnumerable<Point>>>();
     player1_spawns.Add(new Point(0, 1));
     player1_spawns.Add(new Point(0, 2));
     BrawlerFactory brawlerFactory = new BrawlerFactory();
     AddPlayer2Program(brawlerFactory, new Point(13, 12));
     AddPlayer2Program(brawlerFactory, new Point(14, 12));
     AddPlayer2Program(brawlerFactory, new Point(15, 12));
     unavailableNodes = new List<Point>();
     unavailableNodes.Add(new Point(0, 4));
     unavailableNodes.Add(new Point(1, 4));
     unavailableNodes.Add(new Point(2, 4));
     unavailableNodes.Add(new Point(3, 4));
     unavailableNodes.Add(new Point(4, 4));
     unavailableNodes.Add(new Point(5, 4));
     unavailableNodes.Add(new Point(6, 4));
     unavailableNodes.Add(new Point(7, 4));
     unavailableNodes.Add(new Point(15, 4));
     unavailableNodes.Add(new Point(0, 5));
     unavailableNodes.Add(new Point(1, 5));
     unavailableNodes.Add(new Point(2, 5));
     unavailableNodes.Add(new Point(3, 5));
     unavailableNodes.Add(new Point(4, 5));
     unavailableNodes.Add(new Point(5, 5));
     unavailableNodes.Add(new Point(6, 5));
     unavailableNodes.Add(new Point(14, 5));
     unavailableNodes.Add(new Point(15, 5));
     unavailableNodes.Add(new Point(0, 6));
     unavailableNodes.Add(new Point(1, 6));
     unavailableNodes.Add(new Point(2, 6));
     unavailableNodes.Add(new Point(3, 6));
     unavailableNodes.Add(new Point(4, 6));
     unavailableNodes.Add(new Point(5, 6));
     unavailableNodes.Add(new Point(13, 6));
     unavailableNodes.Add(new Point(14, 6));
     unavailableNodes.Add(new Point(15, 6));
     unavailableNodes.Add(new Point(0, 7));
     unavailableNodes.Add(new Point(1, 7));
     unavailableNodes.Add(new Point(2, 7));
     unavailableNodes.Add(new Point(3, 7));
     unavailableNodes.Add(new Point(4, 7));
     unavailableNodes.Add(new Point(12, 7));
     unavailableNodes.Add(new Point(13, 7));
     unavailableNodes.Add(new Point(14, 7));
     unavailableNodes.Add(new Point(15, 7));
     unavailableNodes.Add(new Point(0, 8));
     unavailableNodes.Add(new Point(1, 8));
     unavailableNodes.Add(new Point(2, 8));
     unavailableNodes.Add(new Point(3, 8));
     unavailableNodes.Add(new Point(11, 8));
     unavailableNodes.Add(new Point(12, 8));
     unavailableNodes.Add(new Point(13, 8));
     unavailableNodes.Add(new Point(14, 8));
     unavailableNodes.Add(new Point(15, 8));
     unavailableNodes.Add(new Point(0, 9));
     unavailableNodes.Add(new Point(1, 9));
     unavailableNodes.Add(new Point(2, 9));
     unavailableNodes.Add(new Point(10, 9));
     unavailableNodes.Add(new Point(11, 9));
     unavailableNodes.Add(new Point(12, 9));
     unavailableNodes.Add(new Point(13, 9));
     unavailableNodes.Add(new Point(14, 9));
     unavailableNodes.Add(new Point(15, 9));
     unavailableNodes.Add(new Point(0, 10));
     unavailableNodes.Add(new Point(1, 10));
     unavailableNodes.Add(new Point(9, 10));
     unavailableNodes.Add(new Point(10, 10));
     unavailableNodes.Add(new Point(11, 10));
     unavailableNodes.Add(new Point(12, 10));
     unavailableNodes.Add(new Point(13, 10));
     unavailableNodes.Add(new Point(14, 10));
     unavailableNodes.Add(new Point(15, 10));
     unavailableNodes.Add(new Point(0, 11));
     unavailableNodes.Add(new Point(8, 11));
     unavailableNodes.Add(new Point(9, 11));
     unavailableNodes.Add(new Point(10, 11));
     unavailableNodes.Add(new Point(11, 11));
     unavailableNodes.Add(new Point(12, 11));
     unavailableNodes.Add(new Point(13, 11));
     unavailableNodes.Add(new Point(14, 11));
     unavailableNodes.Add(new Point(15, 11));
 }
Ejemplo n.º 37
0
		void Init ()
		{
				//玩家属性
				player_characrer = GetComponent<PlayerCharacter> ();
				if (player_characrer == null)
						player_characrer = gameObject.AddComponent<PlayerCharacter> ();

				//玩家生命魔法 
				player_health = GetComponent<PlayerHealth> ();
				if (player_health == null)
						player_health = gameObject.AddComponent<PlayerHealth> ();
				player_health.deathDelegate = new Callback(Death);

				//玩家攻击受击
				player_attack = GetComponent<PlayerAttack> ();
				if (player_attack == null)
						player_attack = gameObject.AddComponent<PlayerAttack> ();

				//玩家AI
				player_AI = GetComponent<PlayerAI> ();
				if (player_AI == null)
						player_AI = gameObject.AddComponent<PlayerAI> ();
				player_AI.activeAI = false;

				//搜索敌人
				seclectTarget = GetComponent<SeclectTargetting> ();
				if (seclectTarget == null)
						seclectTarget = gameObject.AddComponent<SeclectTargetting> ();

				//动画管理器
				animator = GetComponent<Animator> ();
				if (animator == null)
						Debug.LogError ("PlayerController Init Error Animator is Null");

				//Animator HashIDs
				hashIDs = GetComponent<AnimatorHashIDs>();
				if(hashIDs = null)
					hashIDs = gameObject.AddComponent<AnimatorHashIDs>();

				//玩家状态机
				player_fsm = new PlayerFSM ();
				player_fsm.start (this);
				player_fsm.change (PlayerFSMStandState.STATE_NAME);
		}