コード例 #1
0
ファイル: Portal.cs プロジェクト: sx2gavin/Portals
    private void CreateTravelerClone(PortalTraveler portalTraveler, bool enteredFromBack)
    {
        lstPortalTravelers.Add(portalTraveler);
        TransformToTarget(portalTraveler.transform, out Vector3 newPos, out Quaternion newRot);
        PortalTraveler travelerCopy = Instantiate(portalTraveler, newPos, newRot);

        travelerCopy.enabled = false;

        SimpleMove simpleMoveComponent = travelerCopy.GetComponent <SimpleMove>();

        if (simpleMoveComponent)
        {
            simpleMoveComponent.enabled = false;
        }

        Sliceable sliceable = portalTraveler.GetComponent <Sliceable>();

        sliceable.SlicePosition = transform.position;
        sliceable.SliceNormal   = transform.forward;
        sliceable.IsSliceable   = true;
        sliceable.Flip          = !enteredFromBack;
        sliceable.UpdateMaterialSlice();

        if (target)
        {
            sliceable = travelerCopy.GetComponent <Sliceable>();
            sliceable.SlicePosition = target.transform.position;
            sliceable.SliceNormal   = target.transform.forward;
            sliceable.IsSliceable   = true;
            sliceable.Flip          = enteredFromBack;
            sliceable.UpdateMaterialSlice();
        }

        travelerCopies.Add(portalTraveler, travelerCopy.gameObject);
    }
コード例 #2
0
ファイル: simpleStats.cs プロジェクト: TrypeTech/GloverRemake
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Q) && CanvasOpen == false)
        {
            move = FindObjectOfType <SimpleMove>();
            // if player cannot move like if he is in event or battle stat
            // no movment should talk place
            if (move.canMove == true)
            {
                SelectedItem = 0;
                move.canMove = false;
                Debug.Log("Opend Stats");
                CanvasOpen = true;
                StatsCanvasPannel.gameObject.SetActive(true);
                player = FindObjectOfType <simplePlayer>();
                AddInventoryItemsToList();
            }
        }
        else if (Input.GetKeyDown(KeyCode.Q) && CanvasOpen == true && move.canMove == false)
        {
            move.canMove = true;
            CanvasOpen   = false;
            StatsCanvasPannel.gameObject.SetActive(false);
            //  AddInventoryItemsToList();
        }

        if (CanvasOpen == true)
        {
            SelectSlots();
        }
    }
コード例 #3
0
 // Use this for initialization
 void Start()
 {
     player    = FindObjectOfType <simplePlayer>();
     movement  = FindObjectOfType <SimpleMove>();
     inventory = FindObjectOfType <simpleInventory>();
     attack    = FindObjectOfType <Attacks>();
     BattlePannel.gameObject.SetActive(false);
 }
コード例 #4
0
 protected override void Awake()
 {
     base.Awake();
     cachedCollider = GetComponent <BoxCollider2D>();
     emitter        = GetComponentInChildren <ParticleSystem>();
     graphic        = GetComponentInChildren <SpriteRenderer>();
     move           = GetComponentInChildren <SimpleMove>();
 }
コード例 #5
0
 void Awake()
 {
     foreach (GameObject go in Monsters)
     {
         go.SetActive(false);
     }
     Monsters[currentMonsters].SetActive(true);
     ++currentMonsters;
     simpleMove = GetComponent<SimpleMove>();
 }
コード例 #6
0
        private IMove CreateMove(Location from, Location to)
        {
            var move = new SimpleMove(from, to);

            if (IsPromotionMove(to))
            {
                return(new PromotionMoveWrapper(move));
            }

            return(move);
        }
コード例 #7
0
ファイル: JumpTree.cs プロジェクト: Chronix/GothicCheckers
 public void AddTargets(JumpTreeNode targetNode, IEnumerable<BoardPosition> targets)
 {
     foreach (BoardPosition pos in targets)
     {
         GameBoard board = targetNode.Board.Copy();
         SimpleMove move = new SimpleMove(board[targetNode.Position].Occupation, targetNode.Position, pos, board[targetNode.Position].Piece == PieceType.King, true);
         board.SetCapture(move);
         board.DoMove(move, true);
         targetNode.Children.Add(new JumpTreeNode { Board = board, Depth = targetNode.Depth + 1, Parent = targetNode, Position = pos, CheckAgain = !move.IsUpgrade });
         ++NodeCount;
     }
 }
コード例 #8
0
ファイル: SimpleSave.cs プロジェクト: TrypeTech/GloverRemake
 public void OnTriggerEnter2D(Collider2D collision)
 {
     if (JustStarted == false)
     {
         Debug.Log("Enterd Collision");
         if (collision.tag == "Player")
         {
             collision.gameObject.GetComponentInChildren <SimpleMove>().canMove = false;
             EnablePopUp();
             move = collision.gameObject.GetComponent <SimpleMove>();
         }
     }
 }
コード例 #9
0
    /// <summary>
    /// 実行処理
    /// </summary>
    public override void Execute()
    {
        Vector3 dir = m_seeControl.GetPlayer().transform.position - obj.transform.position;

        dir.Normalize();

        SimpleMove.SimpleMoving(obj.gameObject, m_rb, dir * obj.CHASE_SPEED);

        if (!m_seeControl.IsLook())
        {
            //状態切替
            obj.ChangeState(GUARD_STATE.ROAM);
        }
    }
コード例 #10
0
        public Player(int bombNumber, int power, int heart, int speed, Coordinates coords) : base(coords)
        {
            NumberOfBombs   = bombNumber;
            BombPower       = power;
            Health          = heart;
            MovementSpeed   = speed;
            PlacedBombCount = 0;

            MoveStrategy      = new SimpleMove();
            PlantBombStrategy = new SimplePlant();

            PlayerIsDead = false;

            SetCoordinates(coords);
            Imune = false;
        }
コード例 #11
0
    public GameObject addBomb(Vector2 position, SimpleMove player)
    {
        int index = (int)position.y * BOARD_WIDTH + (int)position.x;

        if (board [index] == BoardElement.empty)
        {
            board [index] = BoardElement.bomb;
            Transform obj = Instantiate(alternateBomb, new Vector3(index % BOARD_WIDTH, index / BOARD_WIDTH, this.transform.position.z), Quaternion.identity);
            obj.GetComponent <BombScript> ().owner = player;
            NetworkServer.Spawn(obj.gameObject);
            obj.parent = this.transform;
            gameObjects.Add(index, obj.gameObject);
            return(obj.gameObject);
        }
        return(null);
    }
コード例 #12
0
    /*This function is called by the death trap,
     * when we enter it*/
    public void Kill()
    {
        /*If the character was already killed by the trap,
         * we don't want to do anything*/
        if (isKilled)
        {
            return;
        }

        /*If it was not killed, we set the isKilled
         * variable to true*/
        isKilled = true;

        /*We check if the character has a Rigidbody component*/
        Rigidbody rb = GetComponent <Rigidbody>();

        if (rb != null)
        {
            /*If we find the component, we need to set it to kinematic
             * to prevent our character from being launched in the air by
             * the collision with our trap*/
            rb.isKinematic = true;
        }

        /*Here we spawn a blood effect prefab stored in the bloodEffect variable*/
        GameObject.Instantiate(bloodEffect, transform.position + Vector3.up * 2f, Quaternion.identity);

        /*We are getting all the Renderer components of our character*/

        Renderer[] r = GetComponentsInChildren <Renderer>();

        for (int i = 0; i < r.Length; i++)
        {
            /*We are turning all the renderers of, making the object dissapear*/
            r[i].enabled = false;
        }

        /*We are also checking if our character uses our SimpleMove script
         * if so, we are turning it off to prevent player from moving the character
         * after death*/
        SimpleMove move = GetComponent <SimpleMove>();

        if (move != null)
        {
            move.enabled = false;
        }
    }
コード例 #13
0
    /// <summary>
    /// 実行処理
    /// </summary>
    public override void Execute()
    {
        m_timer += Time.deltaTime;
        if (m_timer >= 3.0)
        {
            m_timer = 0.0f;
            SimpleMove.RoamMoving(obj.gameObject, m_rb, obj.MAX_SPEED);
        }


        if (m_seeControl.IsLook())
        {
            Debug.Log("CHANGE");

            //状態切替
            obj.ChangeState(GUARD_STATE.CHASE);
        }
    }
コード例 #14
0
ファイル: JumpTree.cs プロジェクト: Chronix/GothicCheckers
        public JumpTree(BoardPosition root, IEnumerable<BoardPosition> targets, GameBoard board)
        {
            _root = new JumpTreeNode
            {
                Depth = 0,
                Position = root,
                Board = board
            };

            NodeCount = 1;

            foreach (BoardPosition pos in targets)
            {
                GameBoard boardCopy = _root.Board.Copy();
                SimpleMove move = new SimpleMove(boardCopy[_root.Position].Occupation, _root.Position, pos, boardCopy[_root.Position].Piece == PieceType.King);
                boardCopy.SetCapture(move);
                boardCopy.DoMove(move, true);
                _root.Children.Add(new JumpTreeNode { Board = boardCopy, Depth = _root.Depth + 1, Parent = _root, Position = pos, CheckAgain = !move.IsUpgrade });
                ++NodeCount;
            }
        }
コード例 #15
0
    public void StartBattle(SimpleMove move)
    {
        Debug.Log("Hit the trigger");

        List <SimpleClasses.Enamy> EnamyList = new List <SimpleClasses.Enamy>();

        // set up for different areas
        if (area == AreaType.area1)
        {
            for (int i = 0; i < clas.enamies.Count; i++)
            {
                if (clas.enamies[i].classType == SimpleClasses.TypeClass.normal)
                {
                    EnamyList.Add(clas.enamies[i]);
                }
            }

            int enami   = Random.Range(0, EnamyList.Count);
            int enamyLv = Random.Range(LevelLimit - 3, LevelLimit);
            EnamyList[enami].Level = enamyLv;
            battleEvent.StartBattle(EnamyList[enami], move);
        }
    }
コード例 #16
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Q))

        {
            addItem(5);
        }
        // if inventory is on turn it off
        if (Input.GetKeyDown(KeyCode.I))
        {
            move = FindObjectOfType <SimpleMove>();


            if (inInventory == true && move.canMove == false)
            {
                move.canMove = true;
                inInventory  = false;
                InventoryPannel.gameObject.SetActive(false);
            }

            // if inventory is off turn it on
            else if (inInventory == false && move.canMove == true)
            {
                move.canMove = false;
                inInventory  = true;
                InventoryPannel.gameObject.SetActive(true);
                ConstructSlots();
            }
        }


        // manages the selection of the inventory
        if (inInventory == true)
        {
            SelectSlots();
        }
    }
コード例 #17
0
ファイル: Pidgeon.cs プロジェクト: BenHSmith13/UrbanPokemon
 void forgetMove(SimpleMove move)
 {
     //TODO: write this
 }
コード例 #18
0
 // Use this for initialization
 void Start()
 {
     inventory     = FindObjectOfType <Inventory>();
     battleHandler = FindObjectOfType <SimpleBattleHandler>();
     movement      = FindObjectOfType <SimpleMove>();
 }
コード例 #19
0
ファイル: PawnPromotionMove.cs プロジェクト: sreckamp/chess
 public PawnPromotionMove(SimpleMove pawnMove)
 {
     m_pawnMove = pawnMove;
 }
コード例 #20
0
 /// <inheritdoc />
 protected override IMove GetMove(SimpleMove move, int index) => new PawnPromotionMove(move);
コード例 #21
0
 public EnPassantTakeMove(Point from, Point to, Point pawnLocation)
 {
     m_pawnMove     = new SimpleMove(from, to);
     m_pawnLocation = pawnLocation;
 }
コード例 #22
0
ファイル: GameManager.cs プロジェクト: Chronix/GothicCheckers
        public void DoMove(bool addToHistory, params string[] positions)
        {
            ExceptionProvider.ThrowIfNull(positions, GUI.Localization.ErrorMessages.InvalidMoveNotEnoughPositions);
            ExceptionProvider.ThrowInvalidMoveIf(positions.Length < 2, string.Empty);
            IMove move = null;

            if (positions.Length == 2)
            {
                bool kingMove = _board[positions[0]].Piece == PieceType.King;
                move = new SimpleMove(_board[positions[0]].Occupation, positions[0], positions[1], kingMove);
                _board.SetCapture(move);
            }
            else
            {
                move = CompoundMove.FromPositions(_board[positions[0]].Occupation, positions[0], positions.Last(), _board[positions[0]].Piece == PieceType.King, positions.Where((pos, i) => i > 0 && i < positions.Length - 1).ToArray());
            }

            ExceptionProvider.ThrowInvalidMoveIf(!IsPlayersTurn(move.Player), GUI.Localization.ErrorMessages.WaitYourTurn);
            ExceptionProvider.ThrowInvalidMoveIf(!RuleEngine.ValidateMove(_board, move), GUI.Localization.ErrorMessages.InvalidMoveGeneric);

            _board.DoMove(move);
            SwapPlayers();

            if (addToHistory)
            {
                History.Add(new GameHistoryItem(move));
            }

            OnMoveDone();
            Play();
        }
コード例 #23
0
ファイル: PawnOpenMove.cs プロジェクト: sreckamp/chess
 public PawnOpenMove(SimpleMove pawnMove)
 {
     m_pawnMove = pawnMove;
     EnPassant  = new Point((pawnMove.From.X + pawnMove.To.X) / 2, (pawnMove.From.Y + pawnMove.To.Y) / 2);
 }
コード例 #24
0
 /// <inheritdoc />
 protected override IMove GetMove(SimpleMove move, int index) => index > 0 ? (IMove)new PawnOpenMove(move) : move;
コード例 #25
0
        public static void LoadGame(string filePath, ref GameManager manager)
        {
            XmlDocument xDoc = new XmlDocument();
            xDoc.Load(filePath);

            {
                XmlNode root = xDoc.SelectSingleNode("GothicCheckers");
                XmlAttribute formatVersionAttr = root.Attributes["FormatVersion"];

                if (formatVersionAttr == null || formatVersionAttr.Value != SaveFileVersion)
                {
                    OnOldFormatLoading();
                }
            }

            XmlNode diffNode = xDoc.SelectSingleNode("//GameSettings/Difficulty");
            XmlNode ctrlNode = xDoc.SelectSingleNode("//GameSettings/Control");

            XmlNodeList moveNodes = xDoc.SelectNodes("//Moves/Move");

            GameManager.WhiteDifficulty = (GameDifficulty)Enum.Parse(typeof(GameDifficulty), diffNode.Attributes["White"].Value);
            GameManager.BlackDifficulty = (GameDifficulty)Enum.Parse(typeof(GameDifficulty), diffNode.Attributes["Black"].Value);

            manager.WhiteControl = (PlayerControlType)Enum.Parse(typeof(PlayerControlType), ctrlNode.Attributes["White"].Value);
            manager.BlackControl = (PlayerControlType)Enum.Parse(typeof(PlayerControlType), ctrlNode.Attributes["Black"].Value);

            foreach (XmlNode moveNode in moveNodes)
            {
                PlayerColor player = (PlayerColor)Enum.Parse(typeof(PlayerColor), moveNode.Attributes["Player"].Value);
                string from = moveNode.Attributes["From"].Value;
                string to = moveNode.Attributes["To"].Value;
                string through = moveNode.Attributes["Through"] == null ? string.Empty : moveNode.Attributes["Through"].Value;

                IMove move = null;

                if (string.IsNullOrEmpty(through))
                {
                    move = new SimpleMove(player, new BoardPosition(from), new BoardPosition(to), bool.Parse(moveNode.Attributes["KingMove"].Value), false);
                }
                else
                {
                    move = CompoundMove.FromSaveData(player, from, to, through, bool.Parse(moveNode.Attributes["KingMove"].Value));
                }

                if (moveNode.HasChildNodes)
                {
                    move.IsCapture = true;

                    if (move is SimpleMove)
                    {
                        move.Capture = new GameField
                        {
                            Occupation = player == PlayerColor.Black ? PlayerColor.White : PlayerColor.Black,
                            Position = new BoardPosition(moveNode.FirstChild.Attributes["Position"].Value),
                            Piece = (PieceType)Enum.Parse(typeof(PieceType), moveNode.FirstChild.Attributes["Piece"].Value)
                        };
                    }
                    else
                    {
                        CompoundMove cMove = move as CompoundMove;

                        for (int i = 0; i < cMove.Length; ++i)
                        {
                            cMove.Moves[i].IsCapture = true;
                            cMove.Moves[i].Capture = new GameField
                            {
                                Occupation = player == PlayerColor.Black ? PlayerColor.White : PlayerColor.Black,
                                Position = new BoardPosition(moveNode.ChildNodes[i].Attributes["Position"].Value),
                                Piece = (PieceType)Enum.Parse(typeof(PieceType), moveNode.ChildNodes[i].Attributes["Piece"].Value)
                            };
                        }
                    }
                }

                manager.History.Add(new GameHistoryItem(move));
            }
        }
コード例 #26
0
 protected virtual IMove GetMove(SimpleMove move, int index) => move;
コード例 #27
0
    public void StartBattle(SimpleClasses.Enamy enamy, SimpleMove move)
    {
        inBattle = true;
        // temp
        //  player.playerLevel = 10;
        // player.AttackStat = 10;
        // player.SpeedStat = 200;

        // temporary monster stuff
        enamyHpStore            = enamy.Health;
        enamyHealthBar.maxValue = enamy.Health;
        EnamyCurrentHealth      = enamy.Health;
        enamyHealthBar.value    = EnamyCurrentHealth;

        movement = move;
        // disable movement and other input for character
        // enable battle pannel
        BattlePannel.gameObject.SetActive(true);
        movement.canMove = false;
        TempEnamy        = enamy;

        Debug.Log("tempMonHP:" + TempEnamy.Health);
        Debug.Log("TemMonAttack:" + TempEnamy.Attack);
        // remove all information from former battle
        PlayerAttacks.Clear();
        EnamyAttacks.Clear();
        PlayerSkills.Clear();
        PlayerItems.Clear();
        playerHealthBar.maxValue = player.HealthStat;
        playerHealthBar.value    = player.CurrentHealth;

        // updateDamageBars();

        // setup attacks

        for (int i = 0; i < attack.AttackList.Count; i++)
        {
            // check all player attacks
            // set it to the player at begining soon
            if (attack.AttackList[i].type == Attacks.attacks.AttackType.hero1 && attack.AttackList[i].RecLevel <= player.playerLevel && attack.AttackList[i].isItemAttack == false)
            {
                PlayerAttacks.Add(attack.AttackList[i]);
            }
            // add skills list
            if (attack.AttackList[i].type == Attacks.attacks.AttackType.hero1 && attack.AttackList[i].isItemAttack == true)
            {
                for (int a = 0; a < inventory.playerInventory.Count; a++)
                {
                    if (inventory.playerInventory[a] == attack.AttackList[i].AttackItemSimple)
                    {
                        PlayerSkills.Add(attack.AttackList[i]);
                    }
                }
            }

            if (attack.AttackList[i].type == Attacks.attacks.AttackType.normal && attack.AttackList[i].RecLevel <= TempEnamy.Level)
            {
                EnamyAttacks.Add(attack.AttackList[i]);
            }
        }

        SwitchBattleStates(BattleStats.BattleIntro);
    }
コード例 #28
0
ファイル: simpleQuest.cs プロジェクト: TrypeTech/GloverRemake
 public void setMovement()
 {
     move = FindObjectOfType <SimpleMove>();
 }
コード例 #29
0
 void forgetMove(SimpleMove move)
 {
     //TODO: Write ForgetMove
 }
コード例 #30
0
ファイル: CastleMove.cs プロジェクト: sreckamp/chess
 public CastleMove(SimpleMove kingMove, SimpleMove rookMove)
 {
     m_kingMove = kingMove;
     RookMove   = rookMove;
 }
コード例 #31
0
 void Awake()
 {
     bStarter = battleStarter;
     staticNpcPrefab = npcPrefab;
     PlayerData data = DataScript.Load();
     Debug.Log(data.name);
     name = data.name;
     if(data.name.Equals("uninitialized")){
         items = new List<SimpleItem>();
         playersMonsters = new List<SimpleMonster>();
         SimpleMonster monster = new SimpleMonster();
         monster.name = "Snake";
         monster.level = 10;
         monster.totalExp = 10000;
         monster.moves = new List<SimpleMove>();
         monster.status = "OK";
         monster.type = "snake";
         monster.health = 100;
         monster.id = 1;
         SimpleMove move = new SimpleMove();
         move.name = "Bite";
         move.baseAttack = 10;
         move.accuracy = 95;
         move.id = 1;
         move.type = "snake";
         monster.moves.Add (move);
         playersMonsters.Add(monster);
         SimpleBattleNpc bNpc = new SimpleBattleNpc();
         bNpc.finishBattleText = "You suck!";
         bNpc.moneyGiven = 10;
         bNpc.monsters = new List<SimpleMonster>();
         monster = new SimpleMonster();
         monster.name = "Snake";
         monster.level = 10;
         monster.totalExp = 10000;
         monster.moves = new List<SimpleMove>();
         monster.status = "OK";
         monster.type = "snake";
         monster.health = 100;
         monster.id = 1;
         move = new SimpleMove();
         move.name = "Bite";
         move.baseAttack = 10;
         move.accuracy = 95;
         move.id = 1;
         move.type = "snake";
         monster.moves.Add (move);
         bNpc.monsters.Add(monster);
         bNpc.name = "Ben Call";
         bNpc.id = 1;
         bNpc.xPos = 3f;
         bNpc.yPos = 3f;
         simpleBattleNpcs = new List<SimpleBattleNpc>();
         simpleBattleNpcs.Add(bNpc);
         SimpleItem item = new SimpleItem();
         item.buyCost = 100;
         item.name = "Potion";
         item.sellCost = 50;
         items.Add(item);
         SimpleNPC npc = new SimpleNPC();
         npc.name = "Ben Smith";
         npc.conversationText = "Felgergarb";
         npc.xPos = 1.0f;
         npc.yPos = 10.0f;
         simpleNPCs = new List<SimpleNPC>();
         simpleNPCs.Add(npc);
         money = 100;
         playerStartPosX = 0f;
         playerStartPosY = 0f;
         data.name = "Joseph";
         data.items = items;
         data.simpleNpcs = simpleNPCs;
         DataScript.Save (data);
     }
     Debug.Log (data.money);
     foreach(SimpleItem item in data.items){
         Debug.Log (item.name);
     }
     foreach(SimpleNPC npc in data.simpleNpcs){
         Debug.Log (npc.name);
     }
     data.name = "uninitialized";
     DataScript.Save (data);
 }