private void MoveOnBoard()     //Sen går karaktären den valda vägen
    //cameraPos = transform.position;
    //cameraPos.x -= 10;
    //boardCameraMovement.GetTargetPos(cameraPos);

    {
        if (stepList.Count != 0)
        {
            Vector3 targetPos = stepList[0].GetComponent <StepScript>().entryPointPos; //går mot första målet i listan
            transform.position = Vector3.MoveTowards(transform.position, targetPos, movementSpeed);

            if (transform.position == targetPos)     //Den har nått sin target!
            {
                activeStep = stepList[0];
                stepList.Remove(stepList[0]); //Ser till att den går till nästa target
                //GetComponent<PlayerScript>().stepId = targetStep.GetComponent<StepScript>().stepId;
            }
        }
        else   //Den har gått till alla sina target (Den är färdig
               //targetStep.GetComponent<StepScript>().AddCharacter(gameObject);
        {
            stepList.Clear();

            boardCameraMovement.AdjustMode();
            playerPhase = PlayerPhase.eventPhase;
            //boardCameraMovement.cameraState = BoardCameraMovement.CameraState.alterState;
        }
    }
示例#2
0
 void UpdateRespawn()
 {
     foreach (int i in mAllRespawnIndex)
     {
         DTileMap.TileType temp = mTileMap.MapInfo.GetTileTypeIndex(i);
         if (temp == DTileMap.TileType.Floor)
         {
             mTileMap.MapInfo.SetTileTypeIndex(i, DTileMap.TileType.PlayerSpawn, true);
         }
     }
     DTileMap.TileType curValue = mTileMap.MapInfo.GetTileType(mMouseX, mMouseY);
     if (Input.GetMouseButtonDown(0) && curValue == DTileMap.TileType.PlayerSpawn)
     {
         mAlive = true;
         gameObject.collider.renderer.enabled = true;
         Teleport(mMouseX, mMouseY);
         foreach (int i in mAllRespawnIndex)
         {
             DTileMap.TileType temp = mTileMap.MapInfo.GetTileTypeIndex(i);
             if (temp == DTileMap.TileType.PlayerSpawn)
             {
                 mTileMap.MapInfo.SetTileTypeIndex(i, DTileMap.TileType.Floor, true);
             }
         }
         mPlayerPhase = PlayerPhase.Start;
         if (mTurn1 == true)
         {
             mTurn1       = false;
             mPlayerPhase = PlayerPhase.End;
         }
     }
 }
示例#3
0
 void UpdateMove()
 {
     //Debug.Log ("Player::StateMove");
     Travel(mStorePositionX, mStorePositionY);
     mMoved       = true;
     mPlayerPhase = PlayerPhase.Start;
 }
示例#4
0
    // Start is called before the first frame update
    void Start()
    {
        ArenaPhase = PlayerPhase.BABY;
        GameObject musicManagerGameObj = GameObject.Find("Music");

        musicManager = musicManagerGameObj.GetComponent <MusicManagerFightScene>();
    }
示例#5
0
    IEnumerator Enigma(PlayerPhase timerCategory)
    {
        switch (timerCategory)
        {
        case PlayerPhase.Baby:
        {
            yield return(new WaitForSecondsRealtime(timerEnigmaBaby));
        }
        break;

        case PlayerPhase.Adult:
        {
            yield return(new WaitForSecondsRealtime(timerEnigmaAdult));
        }
        break;

        case PlayerPhase.GrandFather:
        {
            yield return(new WaitForSecondsRealtime(timerEnigmaGrandfather));
        }
        break;

        case PlayerPhase.Squeleton:
        {
            yield return(new WaitForSecondsRealtime(timerEnigmaSqueleton));
        }
        break;
        }
        isTimedOut = true;
    }
示例#6
0
    public static void NextPhase()
    {
        switch (playerPhase)
        {
        case PlayerPhase.Spawn:
            playerPhase = PlayerPhase.Ice;
            break;

        case PlayerPhase.Ice:
            playerPhase = PlayerPhase.Desert;
            break;

        case PlayerPhase.Desert:
            playerPhase = PlayerPhase.Forest;
            break;

        case PlayerPhase.Forest:
            playerPhase = PlayerPhase.Final;
            break;

        case PlayerPhase.Final:
            break;

        default:
            break;
        }
    }
示例#7
0
 void UpdatePlay()
 {
     //Debug.Log ("PlayerTurn::PlayCard");
     if (mMouse.cubeActive == true)
     {
         mPlayerPhase = PlayerPhase.Start;
     }
 }
示例#8
0
 public void setPhaseState(PlayerPhase a_phaseState)
 {
     if ((a_phaseState != phaseState) && source.clip != clips[(int)a_phaseState])
     {
         phaseState = a_phaseState;
         source.Pause();
         source.clip = clips[(int)a_phaseState];
         source.Play();
     }
 }
示例#9
0
    private void MoveUp()
    {
        if (playerPosition == PlayerPhase.Up)
            return;

        if (playerPosition == PlayerPhase.Middle)
            playerPosition = PlayerPhase.Up;
        else
            playerPosition = PlayerPhase.Middle;
    }
示例#10
0
    private void MoveDown()
    {
        if (playerPosition == PlayerPhase.Down)
            return;

        if (playerPosition == PlayerPhase.Middle)
            playerPosition = PlayerPhase.Down;
        else
            playerPosition = PlayerPhase.Middle;

    }
示例#11
0
    public void ActivatePhase()
    {
        phase = PlayerPhase.Entry;
        backButton.SetActive(false);
        attackButtons.gameObject.SetActive(false);
        chooseEnemy.SetActive(false);
        confirmDecision.SetActive(false);

        decisionButtons.gameObject.SetActive(true);
        selectedAttack = null;
        cardToAttack   = null;
    }
示例#12
0
 void UpdateAttackMaybe()
 {
     Debug.Log("MayBeAttack");
     if (Input.GetMouseButtonDown(0))
     {
         mAttacked    = true;
         mPlayerPhase = PlayerPhase.Attack;
     }
     else if (Input.GetMouseButtonDown(1))
     {
         mPlayerPhase = PlayerPhase.Attack;
     }
 }
示例#13
0
 void TravelToSewer(int TileX, int TileY)
 {
     DTileMap.TileType temp = mTileMap.MapInfo.GetTileType(TileX, TileY);
     Debug.Log("TileType1" + temp);
     mTileMap.MapInfo.SetTileType(mPositionX, mPositionY, DTileMap.TileType.Floor, true);
     gameObject.renderer.enabled = false;
     mPositionX = TileX;
     mPositionY = TileY;
     gameObject.renderer.enabled = false;
     mTileMap.MapInfo.SetTileType(TileX, TileY, DTileMap.TileType.Sewer, true);
     mPlayerPhase = PlayerPhase.End;
     temp         = mTileMap.MapInfo.GetTileType(TileX, TileY);
     Debug.Log("TileType2" + temp);
 }
示例#14
0
文件: Player.cs 项目: CHE6yp/Colonize
    public void Rpc_RollDice(int seed)
    {
        Random.InitState(seed);

        if (Dices.singleton.Roll() == 7)
        {
            playerPhase = PlayerPhase.MoveRobber;
        }
        else
        {
            playerPhase = PlayerPhase.TurnPhase;
        }

        rolledDice = true;
    }
示例#15
0
 void UpdateSewer()
 {
     if (mSewerWalkable == false)
     {
         foreach (int i in mAllSewerIndex)
         {
             DTileMap.TileType temp = mTileMap.MapInfo.GetTileTypeIndex(i);
             if (temp == DTileMap.TileType.Sewer)
             {
                 mTileMap.MapInfo.SetTileTypeIndex(i, DTileMap.TileType.TrueSewer, true);
             }
         }
     }
     DTileMap.TileType curValue = mTileMap.MapInfo.GetTileType(mMouseX, mMouseY);
     if (Input.GetMouseButtonDown(0) && curValue == DTileMap.TileType.TrueSewer)
     {
         Teleport(mMouseX, mMouseY);
         foreach (int i in mAllSewerIndex)
         {
             DTileMap.TileType temp = mTileMap.MapInfo.GetTileTypeIndex(i);
             if (temp == DTileMap.TileType.TrueSewer)
             {
                 mTileMap.MapInfo.SetTileTypeIndex(i, DTileMap.TileType.Sewer, true);
             }
         }
         FindWalkRange(1);
         curValue       = mTileMap.MapInfo.GetTileType(mMouseX, mMouseY);
         mSewerWalkable = true;
     }
     if (Input.GetMouseButtonDown(0) && curValue == DTileMap.TileType.Walkable && mSewerWalkable == true)
     {
         Teleport(mMouseX, mMouseY);
         foreach (int i in mIntList)
         {
             if (mTileMap.MapInfo.GetTileTypeIndex(i) == DTileMap.TileType.Walkable)
             {
                 mTileMap.MapInfo.SetTileTypeIndex(i, DTileMap.TileType.Floor, true);
             }
         }
         mOnSewer = false;
         gameObject.renderer.enabled = true;
         mPlayerPhase   = PlayerPhase.Start;
         mSewerWalkable = false;
     }
 }
    public void GetTurn()   //Det som händer när turen startar
    {
        playerNr     = GetComponent <PlayerScript>().playerNr;
        isPlayerTurn = true;
        hasTarget    = false;
        hasRolled    = false;
        playerPhase  = PlayerPhase.itemPhase;
        playerMove   = PlayerMove.rollDie;
        targetStep   = activeStep;
        choiceNr     = 0;

        boardCameraMovement.GetPlayer(transform.gameObject, playerNr);
        boardCameraMovement.AdjustMode();

        gameboard.GetPlayerTurn("Player " + playerNr + "'s turn!");
        //routeList.Clear();
        //allRouteList.Clear();
    }
示例#17
0
    // Start is called before the first frame update
    void Start()
    {
        pooPrefab = Resources.Load("Prefabs/Objects/Poo");

        animator       = GetComponent <Animator>();
        spriteRenderer = GetComponent <SpriteRenderer>();
        rigidbody      = GetComponent <Rigidbody2D>();
        onFloor        = true;
        front          = false;
        grabbed        = null;
        rightdir       = true;
        strikeTimer    = 0f;
        CurrentPhase   = PlayerPhase.BABY;
        throwTimer     = 0f;
        throwing       = false;
        ThrowForce     = 1f;

        spriteRenderer.material.SetFloat("_IsBackground", 1.0f);
    }
示例#18
0
    // Update is called once per frame
    void Update()
    {
        var newArenaPhase = CheckArenaPhase();

        if (newArenaPhase != ArenaPhase)
        {
            ArenaPhase = newArenaPhase;
            musicManager.setPhaseState(ArenaPhase);
            NewPhaseTransition();
        }

        //time
        var players = GameObject.FindGameObjectsWithTag("Player");

        foreach (GameObject player in players)
        {
            player.GetComponent <PlayerController>().Age += Time.deltaTime * TimeScale;
        }
    }
示例#19
0
 void UpdateMayBeMove()
 {
     //Debug.Log ("Player::StatePath");
     PathFind(mPositionX, mPositionY, mStorePositionX, mStorePositionY);
     DTileMap.TileType temp = mTileMap.MapInfo.GetTileType(mMouseX, mMouseY);
     if (temp == DTileMap.TileType.Walkable || temp == DTileMap.TileType.Path)
     {
         mStorePositionX = mMouseX;
         mStorePositionY = mMouseY;
     }
     else if (mMouseY == mStorePositionY && mMouseX == mStorePositionX && Input.GetMouseButtonDown(0))
     {
         mPlayerPhase = PlayerPhase.Move;
     }
     else if (Input.GetMouseButtonDown(1))
     {
         ResetPath();
         mPlayerPhase = PlayerPhase.Start;
     }
 }
示例#20
0
    void WeldingtonActive()
    {
        WeldingtonAutomaton i = new WeldingtonAutomaton();

        if (mIsU == true)
        {
            mAttack   = i.mInputAttack + 3;
            mMovement = i.mInputMovement;
            mIsU      = false;
        }
        else
        {
            mMovement = i.mInputMovement + 3;
            mAttack   = i.mInputAttack;
            mIsU      = true;
        }
        ResetWalkRange();
        mSkillsCD    = 3;
        mPlayerPhase = PlayerPhase.Start;
    }
示例#21
0
    void ThordrannActive(int randomMovement)
    {
        int maxX = mTileMap.MapInfo.size_x;
        int maxY = mTileMap.MapInfo.size_y;
        int minX = 0;
        int minY = 0;

        int rightX = 0;
        int rightY = 0;
        int leftX  = 0;
        int leftY  = 0;
        int upX    = 0;
        int upY    = 0;
        int downX  = 0;
        int downY  = 0;

        ResetWalkRange();
        //Discard a card
        //Check for movmement
        int rushMovement = randomMovement + mMovement;
        //Right
        int  count = 0;
        bool Check = false;

        while (Check == false || count <= rushMovement)
        {
            rightX = mPositionX + count;
            rightY = mPositionY;
            if (rightX > maxX)
            {
                rightX = maxX;
                Check  = false;
                break;
            }
            DTileMap.TileType rushRight = mTileMap.MapInfo.GetTileType(rightX, rightY);
            if (rushRight != DTileMap.TileType.Floor ||
                rushRight != DTileMap.TileType.Sewer)
            {
                Check = true;
                break;
            }
            count++;
        }
        if (mTileMap.MapInfo.GetTileType(rightX - 1, rightY) == DTileMap.TileType.Floor)
        {
            mTileMap.MapInfo.SetTileType(rightX - 1, rightY, DTileMap.TileType.Walkable, true);
        }
        else if (mTileMap.MapInfo.GetTileType(rightX - 1, rightY) == DTileMap.TileType.Sewer)
        {
            mTileMap.MapInfo.SetTileType(rightX - 1, rightY, DTileMap.TileType.TrueSewer, true);
        }

        //Left
        count = 0;
        Check = false;
        while (Check == false || count <= rushMovement)
        {
            leftX = mPositionX - count;;
            leftY = mPositionY;
            if (leftX < minX)
            {
                leftX = minX;
                Check = false;
                break;
            }
            DTileMap.TileType rushLeft = mTileMap.MapInfo.GetTileType(leftX, leftY);
            if (rushLeft != DTileMap.TileType.Floor ||
                rushLeft != DTileMap.TileType.Sewer)
            {
                Check = true;
                break;
            }
            count++;
        }
        if (mTileMap.MapInfo.GetTileType(leftX + 1, mPositionY) == DTileMap.TileType.Floor)
        {
            mTileMap.MapInfo.SetTileType(leftX + 1, mPositionY, DTileMap.TileType.Walkable, true);
        }
        else if (mTileMap.MapInfo.GetTileType(leftX + 1, mPositionY) == DTileMap.TileType.Sewer)
        {
            mTileMap.MapInfo.SetTileType(leftX + 1, mPositionY, DTileMap.TileType.TrueSewer, true);
        }
        //Up
        count = 0;
        Check = false;
        while (Check == false || count <= rushMovement)
        {
            upX = mPositionX;
            upY = mPositionY + count;
            if (upY > maxY)
            {
                upY   = maxY;
                Check = false;
                break;
            }
            DTileMap.TileType rushUp = mTileMap.MapInfo.GetTileType(upX, upY);
            if (rushUp != DTileMap.TileType.Floor ||
                rushUp != DTileMap.TileType.Sewer)
            {
                Check = true;
                break;
            }
            count++;
        }
        if (mTileMap.MapInfo.GetTileType(upX, upY - 1) == DTileMap.TileType.Floor)
        {
            mTileMap.MapInfo.SetTileType(upX, upY - 1, DTileMap.TileType.Walkable, true);
        }
        else if (mTileMap.MapInfo.GetTileType(upX, upY - 1) == DTileMap.TileType.Sewer)
        {
            mTileMap.MapInfo.SetTileType(upX, upY - 1, DTileMap.TileType.TrueSewer, true);
        }

        //Down
        count = 0;
        Check = false;
        while (Check == false || count <= rushMovement)
        {
            downX = mPositionX;
            downY = mPositionY - count;
            if (downY > minY)
            {
                downY = minY;
                Check = false;
                break;
            }
            DTileMap.TileType rushDown = mTileMap.MapInfo.GetTileType(downX, downY);
            if (rushDown != DTileMap.TileType.Floor ||
                rushDown != DTileMap.TileType.Sewer)
            {
                Check = true;
                break;
            }
            count++;
        }
        if (mTileMap.MapInfo.GetTileType(downX, downY + 1) == DTileMap.TileType.Floor)
        {
            mTileMap.MapInfo.SetTileType(downX, downY + 1, DTileMap.TileType.Walkable, true);
        }
        else if (mTileMap.MapInfo.GetTileType(downX, downY + 1) == DTileMap.TileType.Sewer)
        {
            mTileMap.MapInfo.SetTileType(downX, downY + 1, DTileMap.TileType.TrueSewer, true);
        }
        DTileMap.TileType curType = mTileMap.MapInfo.GetTileType(mMouseX, mMouseY);
        if (Input.GetMouseButtonDown(0) && curType == DTileMap.TileType.Walkable)
        {
            Travel(mMouseX, mMouseY);
            if (mTileMap.MapInfo.GetTileType(downX, downY + 1) == DTileMap.TileType.Walkable)
            {
                mTileMap.MapInfo.SetTileType(downX, downY + 1, DTileMap.TileType.Floor, true);
            }
            else if (mTileMap.MapInfo.GetTileType(downX, downY + 1) == DTileMap.TileType.TrueSewer)
            {
                mTileMap.MapInfo.SetTileType(downX, downY + 1, DTileMap.TileType.Sewer, true);
            }
            if (mTileMap.MapInfo.GetTileType(upX, upY - 1) == DTileMap.TileType.Walkable)
            {
                mTileMap.MapInfo.SetTileType(upX, upY - 1, DTileMap.TileType.Floor, true);
            }
            else if (mTileMap.MapInfo.GetTileType(upX, upY - 1) == DTileMap.TileType.TrueSewer)
            {
                mTileMap.MapInfo.SetTileType(upX, upY - 1, DTileMap.TileType.Sewer, true);
            }
            if (mTileMap.MapInfo.GetTileType(leftX + 1, leftY) == DTileMap.TileType.Walkable)
            {
                mTileMap.MapInfo.SetTileType(leftX + 1, leftY, DTileMap.TileType.Floor, true);
            }
            else if (mTileMap.MapInfo.GetTileType(leftX + 1, leftY) == DTileMap.TileType.TrueSewer)
            {
                mTileMap.MapInfo.SetTileType(leftX + 1, leftY, DTileMap.TileType.Sewer, true);
            }
            if (mTileMap.MapInfo.GetTileType(rightX - 1, rightY) == DTileMap.TileType.Walkable)
            {
                mTileMap.MapInfo.SetTileType(rightX - 1, rightY, DTileMap.TileType.Floor, true);
            }
            else if (mTileMap.MapInfo.GetTileType(rightX - 1, rightY) == DTileMap.TileType.TrueSewer)
            {
                mTileMap.MapInfo.SetTileType(rightX - 1, rightY, DTileMap.TileType.Sewer, true);
            }
            mMoved       = true;
            mPlayerPhase = PlayerPhase.Start;
        }
        else if (Input.GetMouseButtonDown(0) && curType == DTileMap.TileType.TrueSewer)
        {
            TravelToSewer(mMouseX, mMouseY);
            mOnSewer     = true;
            mMoved       = true;
            mPlayerPhase = PlayerPhase.Start;
        }
        else if (Input.GetMouseButtonDown(1))
        {
            mPlayerPhase = PlayerPhase.Start;
        }
    }
示例#22
0
 void UpdateAttack()
 {
     if (mManager.HudUpdated)
     {
         Debug.Log("Attack" + mManager.HudUpdated);
         DTileMap.TileType AttackingTarget = mManager.curDefending;
         if (AttackingTarget >= DTileMap.TileType.Target1)
         {
             BaseTarget targetDefending = mManager.CurrentTargetDefender();
             if (mManager.AttackWorked)
             {
                 Debug.Log("Target Die");
                 mInfamy += targetDefending.mInfamy;
                 targetDefending.UpdateDie();
             }
             else
             {
                 Debug.Log("Both Live");
                 targetDefending.mState = BaseTarget.State.Run;
             }
         }
         else
         {
             Player playerDefending = mManager.CurrentPlayerDefender();
             if (mManager.AttackWorked)
             {
                 Debug.Log("Attack Worked");
                 Debug.Log("you die");
                 if (playerDefending.mInfamy > mInfamy)
                 {
                     mInfamy++;
                     playerDefending.mInfamy--;
                 }
                 playerDefending.mAlive = false;
                 playerDefending.gameObject.renderer.enabled = false;
                 int positionX = playerDefending.mPositionX;
                 int positionY = playerDefending.mPositionY;
                 mTileMap.MapInfo.SetTileType(positionX, positionY, DTileMap.TileType.Floor, true);
             }
             else if (mManager.CounterAttackWorked)
             {
                 Debug.Log("Counter Attack Worked");
                 Debug.Log("I die");
                 if (playerDefending.mInfamy < mInfamy)
                 {
                     mInfamy--;
                     playerDefending.mInfamy++;
                 }
                 gameObject.renderer.enabled = false;
                 mTileMap.MapInfo.SetTileType(mPositionX, mPositionY, DTileMap.TileType.Floor, true);
             }
             else
             {
                 Debug.Log("Both Live");
             }
         }
         if (mManager.HudUpdated)
         {
             mPlayerPhase = PlayerPhase.End;
         }
     }
 }
示例#23
0
    void SwitchPhase(PlayerPhase nextPhase)
    {
        if (phase == PlayerPhase.Entry)
        {
            //we either quit or we clicked on attacks
            if (nextPhase == PlayerPhase.ChooseAttack)
            {
                decisionButtons.gameObject.SetActive(false);
                attackButtons.gameObject.SetActive(true);
                decisionGlow.SetActive(false);
                backButton.SetActive(true);

                //setup buttons
                SetupAttackButtons();
            }
        }
        else if (phase == PlayerPhase.ChooseAttack)
        {
            //we either clicked an attack, or we went back to decisions
            if (nextPhase == PlayerPhase.ChooseEnemy)
            {
                attackButtons.gameObject.SetActive(false);
                attackGlow.SetActive(false);
                chooseEnemy.SetActive(true);
            }
            else if (nextPhase == PlayerPhase.Entry)
            {
                decisionButtons.gameObject.SetActive(true);
                attackButtons.gameObject.SetActive(false);
                backButton.SetActive(false);
            }
        }
        else if (phase == PlayerPhase.ChooseEnemy)
        {
            //we either clicked an attack, or we went back to decisions
            if (nextPhase == PlayerPhase.ConfirmAttack)
            {
                attackButtons.gameObject.SetActive(false);
                cardGlow.SetActive(false);
                backButton.SetActive(false);
                confirmDecision.SetActive(true);
                chooseEnemy.SetActive(false);
            }
            else if (nextPhase == PlayerPhase.ChooseAttack)//we went back
            {
                decisionButtons.gameObject.SetActive(false);
                attackButtons.gameObject.SetActive(true);
                chooseEnemy.SetActive(false);
            }
        }
        else if (phase == PlayerPhase.ConfirmAttack)
        {
            //we either clicked an attack, or we went back to decisions
            if (nextPhase == PlayerPhase.Attacking)
            {
                attackButtons.gameObject.SetActive(false);
                cardGlow.SetActive(false);
                backButton.SetActive(false);
                confirmDecision.SetActive(false);
                SendAttack();
            }
            else if (nextPhase == PlayerPhase.ChooseEnemy)//we went back
            {
                decisionButtons.gameObject.SetActive(false);
                attackButtons.gameObject.SetActive(false);
                confirmDecision.SetActive(false);
                backButton.SetActive(true);
                chooseEnemy.SetActive(true);
            }
        }

        AudioSource.PlayClipAtPoint(clickSound, cam.transform.position);

        phase = nextPhase;
        decisionGlow.SetActive(false);
    }
示例#24
0
    void UpdateStart()
    {
        if (mAlive == false)
        {
            mPlayerPhase = PlayerPhase.Respawn;
        }
        else if (mOnSewer)
        {
            mPlayerPhase = PlayerPhase.Sewer;
        }
        else
        {
            if (Input.GetMouseButtonDown(1))
            {
                ResetWalkRange();
                mPlayerPhase = PlayerPhase.End;
            }
            if (mMouse.cubeActive == true)
            {
                ResetFindAttackRange();
                FindAttackRange();
                if (mAttackList != null)
                {
                    int count = 0;
                    foreach (Vector3 i in mAttackPosition)
                    {
                        mAttackSelect[count].position         = i;
                        mAttackSelect[count].renderer.enabled = true;
                        count++;
                    }
                }
                else
                {
                    for (int i = 0; i < 4; i++)
                    {
                        mAttackSelect[i].renderer.enabled = false;
                    }
                }
                //Debug.Log ("Player::StateStart");
                if (mMoved == false)
                {
                    FindWalkRange(mMovement);                           //FInd all walkable Tiles
                }
                else
                {
                    ResetWalkRange();
                    ResetPath();
                }
                if (Input.GetMouseButtonDown(0))
                {
                    mStorePositionX = mMouseX;
                    mStorePositionY = mMouseY;
                    DTileMap.TileType temp = mTileMap.MapInfo.GetTileType(mStorePositionX, mStorePositionY);
                    switch (temp)
                    {
                    case DTileMap.TileType.Floor:
                        Debug.Log("Player::Floor(out of range) " + mMouseClickPhase);
                        mMouseClickPhase = 0;
                        break;

                    case DTileMap.TileType.Walkable:
                        Debug.Log("Player::Walkable");
                        if (mMoved == false)
                        {
                            mPlayerPhase = PlayerPhase.MayBeMove;
                        }
                        break;

                    case DTileMap.TileType.Path:
                        Debug.Log("Player::Path: Invalid");
                        if (mMoved == false)
                        {
                            mPlayerPhase = PlayerPhase.MayBeMove;
                        }
                        break;

                    case DTileMap.TileType.Wall:
                        Debug.Log("Player::Wall: Can't travel");
                        break;

                    case DTileMap.TileType.Sewer:
                        Debug.Log("Player::Sewer: out of range");
                        break;

                    case DTileMap.TileType.PlayerSpawn:
                        Debug.Log("Player::PlayerSpawn");
                        break;

                    case DTileMap.TileType.Player1:
                        Debug.Log("Player::Player1");
                        mManager.curDefending = DTileMap.TileType.Player1;
                        foreach (DTileMap.TileType i in mAttackList)
                        {
                            if (i == DTileMap.TileType.Player1)
                            {
                                mPlayerPhase = PlayerPhase.AttackMaybe;
                            }
                        }
                        break;

                    case DTileMap.TileType.Player2:
                        Debug.Log("Player::Player2");
                        mManager.curDefending = DTileMap.TileType.Player2;
                        foreach (DTileMap.TileType i in mAttackList)
                        {
                            if (i == DTileMap.TileType.Player2)
                            {
                                mPlayerPhase = PlayerPhase.AttackMaybe;
                            }
                        }
                        break;

                    case DTileMap.TileType.Player3:
                        Debug.Log("Player::Player3");

                        mManager.curDefending = DTileMap.TileType.Player3;
                        foreach (DTileMap.TileType i in mAttackList)
                        {
                            if (i == DTileMap.TileType.Player3)
                            {
                                mPlayerPhase = PlayerPhase.AttackMaybe;
                            }
                        }
                        break;

                    case DTileMap.TileType.Player4:
                        Debug.Log("Player::Player4");
                        mManager.curDefending = DTileMap.TileType.Player4;
                        foreach (DTileMap.TileType i in mAttackList)
                        {
                            if (i == DTileMap.TileType.Player4)
                            {
                                mPlayerPhase = PlayerPhase.AttackMaybe;
                            }
                        }
                        break;

                    case DTileMap.TileType.Target1:
                        Debug.Log("Player::Target1");
                        mManager.curDefending = DTileMap.TileType.Target1;
                        curTarget             = DTileMap.TileType.Target1;
                        foreach (DTileMap.TileType i in mAttackList)
                        {
                            if (i == DTileMap.TileType.Target1)
                            {
                                mPlayerPhase = PlayerPhase.AttackMaybe;
                            }
                        }
                        break;

                    case DTileMap.TileType.Target2:
                        Debug.Log("Player::Target2");
                        mManager.curDefending = DTileMap.TileType.Target2;
                        foreach (DTileMap.TileType i in mAttackList)
                        {
                            if (i == DTileMap.TileType.Target2)
                            {
                                mPlayerPhase = PlayerPhase.AttackMaybe;
                            }
                        }
                        break;

                    case DTileMap.TileType.Target3:
                        Debug.Log("Player::Target3");
                        mManager.curDefending = DTileMap.TileType.Target3;
                        foreach (DTileMap.TileType i in mAttackList)
                        {
                            if (i == DTileMap.TileType.Target3)
                            {
                                mPlayerPhase = PlayerPhase.AttackMaybe;
                            }
                        }
                        break;

                    case DTileMap.TileType.TrueSewer:                                   //Transfer to Sewer EndTurn
                        Debug.Log("Player::TrueSewer");
                        mOnSewer = true;
                        TravelToSewer(mStorePositionX, mStorePositionY);
                        ResetPath();
                        break;
                    }
                }
            }
            else if (mMouse.cubeActive == false)
            {
                mPlayerPhase = PlayerPhase.Play;
            }
            if (Input.GetKeyDown("s") && mSkillsCD == 0)
            {
                if (mCharacter == Character.Thordrann)
                {
                    mRandomMovement = Random.Range(1, 8);
                    Debug.Log("You roll a " + mRandomMovement);
                }
                mPlayerPhase = PlayerPhase.Special;
            }
        }
        //Debug.Log ("Player: "+ mPlayerIndex);
    }
示例#25
0
 // Use this for initialization
 void Start()
 {
     direction = new Vector3[member_count];
     moved_pos = new Vector3[member_count];
     animating_check = new float[member_count];
     gameObject.transform.position = new Vector3(0, -150, 0);
     control_option = (int)GameManager.setting_control;
     mover_phase = PlayerPhase.LIVE;
     MP_current = MP_max * 0.3f;
 }
示例#26
0
    IEnumerator ForceMove(Vector3 targer_pos) // (x축, y축, 플레이어 넘버)
    {
        mover_phase = PlayerPhase.INVINCIBLE;
        int i_ = 5;
        if (targer_pos.z == 5)
        {
            for (int i = 0; i < 3; i++)
            {
                if (players_info[i].position == (Position)0)
                {
                    i_ = i;
                    break;
                }
            }
        }
        else
        {
            i_ = (int)targer_pos.z;
        }
        forced_move = true;
        while (forced_move == true)
        {
            direction[i_] = targer_pos - players_info[i_].gameObject.transform.position;

            moved_pos[i_] = 600f * direction[i_].normalized * Time.deltaTime;
            if (moved_pos[i_].sqrMagnitude > direction[i_].sqrMagnitude)
                moved_pos[i_] = direction[i_];
            players_info[i_].transform.Translate(moved_pos[i_], Space.World);
            if (direction[i_] == Vector3.zero)
                forced_move = false;
            yield return null;
        }
        mover_phase = PlayerPhase.LIVE;
        yield return null;
    }
示例#27
0
    private void UpdatePlayerPhase()
    {
        PlayerPhase newphase;

        if (Age < 3)
        {
            newphase       = PlayerPhase.BABY;
            CurrentPhase   = newphase;
            Speed          = 1;
            JumpForce      = 0;
            ThrowForce     = 0.5f;
            MaxCarryWeigth = 1f;
        }
        else if (Age < 10)
        {
            newphase       = PlayerPhase.CHILD;
            Speed          = 2;
            JumpForce      = 6;
            ThrowForce     = 1.5f;
            MaxCarryWeigth = 2f;
        }
        else if (Age < 18)
        {
            newphase             = PlayerPhase.TEEN;
            Speed                = 3;
            JumpForce            = 8;
            ThrowForce           = 2f;
            MaxCarryWeigth       = 3f;
            transform.localScale = new Vector3(1, 1.4f, 1);
        }
        else if (Age < 60)
        {
            newphase             = PlayerPhase.ADULT;
            Speed                = 3;
            JumpForce            = 8;
            ThrowForce           = 2.5f;
            MaxCarryWeigth       = 3f;
            transform.localScale = new Vector3(1.2f, 1.6f, 1);
        }
        else if (Age < 100)
        {
            newphase             = PlayerPhase.OLD;
            Speed                = 2;
            JumpForce            = 6;
            ThrowForce           = 1.8f;
            MaxCarryWeigth       = 2f;
            transform.localScale = new Vector3(1.2f, 1.4f, 1);
        }
        else
        {
            newphase               = PlayerPhase.GHOST;
            Speed                  = 2;
            JumpForce              = 0.6f;
            ThrowForce             = 0f;
            rigidbody.gravityScale = 0.1f;
            MaxCarryWeigth         = 2f;
        }

        if (newphase != CurrentPhase)
        {
            if (newphase == PlayerPhase.GHOST)
            {
                var tomb = Instantiate(TombStonePrefab, transform.position, Quaternion.identity) as GameObject;
            }

            CurrentPhase = newphase;
            UpdatePlayerSprite();
            Reset();
        }
    }
示例#28
0
 IEnumerator BeInvincible(float time_)
 {
     mover_phase = PlayerPhase.INVINCIBLE;
     yield return new WaitForSeconds(time_);
     mover_phase = PlayerPhase.LIVE;
 }
示例#29
0
 private void Awake()
 {
     playerPhase = PlayerPhase.Spawn;
 }
    void Update()
    {
        if (isPlayerTurn)
        {
            switch (playerPhase)
            {
            case PlayerPhase.itemPhase:
                //Check if use item or roll (or both)
                //Debug.Log("Didn't use Item");
                boardCameraMovement.SetRollState();
                SendDies();
                playerPhase = PlayerPhase.movePhase;

                break;

            case PlayerPhase.movePhase:
                //Roll die and Move to next step
                switch (playerMove)
                {
                case PlayerMove.rollDie:
                    //boardCameraMovement.cameraState = BoardCameraMovement.CameraState.povState;

                    if (!hasRolled)
                    {
                        RollDie();
                    }
                    break;

                case PlayerMove.getSteps:

                    GetTargetSteps();
                    break;

                case PlayerMove.chooseRoute:

                    if (boardCameraMovement.cameraState == BoardCameraMovement.CameraState.alterState)
                    {
                        ChooseStepPath();
                    }
                    break;

                case PlayerMove.walk:

                    MoveOnBoard();
                    break;
                }
                break;

            case PlayerPhase.eventPhase:
                //Check if event happens on step
                //Debug.Log("Implement eventPhase");
                playerPhase = PlayerPhase.endPhase;
                break;

            case PlayerPhase.endPhase:
                //Debug.Log("Implement endPhase");
                EndTurn();
                //Use items or end turn (or both)
                break;
            }
        }
    }
示例#31
0
    void AnchorbeardActive()
    {
        ResetWalkRange();
        int rightX = 0;
        int rightY = 0;
        int leftX  = 0;
        int leftY  = 0;
        int upX    = 0;
        int upY    = 0;
        int downX  = 0;
        int downY  = 0;

        //Still need to discard a card
        for (int hookamount = 3; hookamount >= 2; hookamount--)
        {
            rightX = mPositionX + hookamount;
            rightY = mPositionY;
            leftX  = mPositionX - hookamount;
            leftY  = mPositionY;
            upX    = mPositionX;
            upY    = mPositionY + hookamount;
            downX  = mPositionX;
            downY  = mPositionY - hookamount;
            DTileMap.TileType hookRight = mTileMap.MapInfo.GetTileType(rightX, rightY);
            DTileMap.TileType hookLeft  = mTileMap.MapInfo.GetTileType(leftX, leftY);
            DTileMap.TileType hookUp    = mTileMap.MapInfo.GetTileType(upX, upY);
            DTileMap.TileType hookDown  = mTileMap.MapInfo.GetTileType(downX, downY);
            if (hookRight == DTileMap.TileType.Wall || hookRight == DTileMap.TileType.Target1 || hookRight == DTileMap.TileType.Target2 || hookRight == DTileMap.TileType.Target3)
            {
                DTileMap.TileType Check = mTileMap.MapInfo.GetTileType(rightX - 1, rightY);
                if (Check == DTileMap.TileType.Floor)
                {
                    mTileMap.MapInfo.SetTileType(rightX - 1, rightY, DTileMap.TileType.Walkable, true);
                }
            }
            if (hookLeft == DTileMap.TileType.Wall || hookLeft == DTileMap.TileType.Target1 || hookLeft == DTileMap.TileType.Target2 || hookLeft == DTileMap.TileType.Target3)
            {
                DTileMap.TileType Check = mTileMap.MapInfo.GetTileType(leftX + 1, leftY);
                if (Check == DTileMap.TileType.Floor)
                {
                    mTileMap.MapInfo.SetTileType(leftX + 1, leftY, DTileMap.TileType.Walkable, true);
                }
            }
            if (hookUp == DTileMap.TileType.Wall || hookUp == DTileMap.TileType.Target1 || hookUp == DTileMap.TileType.Target2 || hookUp == DTileMap.TileType.Target3)
            {
                DTileMap.TileType Check = mTileMap.MapInfo.GetTileType(upX, upY - 1);
                if (Check == DTileMap.TileType.Floor)
                {
                    mTileMap.MapInfo.SetTileType(upX, upY - 1, DTileMap.TileType.Walkable, true);
                }
            }
            if (hookDown == DTileMap.TileType.Wall || hookDown == DTileMap.TileType.Target1 || hookDown == DTileMap.TileType.Target2 || hookDown == DTileMap.TileType.Target3)
            {
                DTileMap.TileType Check = mTileMap.MapInfo.GetTileType(downX, downY - 1);
                if (Check == DTileMap.TileType.Floor)
                {
                    mTileMap.MapInfo.SetTileType(downX, downY + 1, DTileMap.TileType.Walkable, true);
                }
            }
        }
        DTileMap.TileType curType = mTileMap.MapInfo.GetTileType(mMouseX, mMouseY);
        if (Input.GetMouseButtonDown(0) && curType == DTileMap.TileType.Walkable)
        {
            Travel(mMouseX, mMouseY);
            if (mTileMap.MapInfo.GetTileType(downX, downY + 1) == DTileMap.TileType.Walkable)
            {
                mTileMap.MapInfo.SetTileType(downX, downY + 1, DTileMap.TileType.Floor, true);
            }
            if (mTileMap.MapInfo.GetTileType(upX, upY - 1) == DTileMap.TileType.Walkable)
            {
                mTileMap.MapInfo.SetTileType(upX, upY - 1, DTileMap.TileType.Floor, true);
            }
            if (mTileMap.MapInfo.GetTileType(leftX + 1, leftY) == DTileMap.TileType.Walkable)
            {
                mTileMap.MapInfo.SetTileType(leftX + 1, leftY, DTileMap.TileType.Floor, true);
            }
            if (mTileMap.MapInfo.GetTileType(rightX - 1, rightY) == DTileMap.TileType.Walkable)
            {
                mTileMap.MapInfo.SetTileType(rightX - 1, rightY, DTileMap.TileType.Floor, true);
            }
            mPlayerPhase = PlayerPhase.Start;
        }
        else if (Input.GetMouseButtonDown(1))
        {
            mPlayerPhase = PlayerPhase.Start;
        }
    }
示例#32
0
    public GameObject Self;                                                     //GameObject itself

    void Start()
    {
        //Hack
        mAllRespawnIndex.Add(256);
        mAllRespawnIndex.Add(73);
        mAllRespawnIndex.Add(330);
        mAllRespawnIndex.Add(10);
        mAllRespawnIndex.Add(198);
        mAllRespawnIndex.Add(314);
        mAllRespawnIndex.Add(86);
        mAllRespawnIndex.Add(386);
        mAllRespawnIndex.Add(252);
        mAllRespawnIndex.Add(114);

        mAllSewerIndex.Add(325);
        mAllSewerIndex.Add(118);
        mAllSewerIndex.Add(101);
        mAllSewerIndex.Add(333);
        mAllSewerIndex.Add(383);
        mAllSewerIndex.Add(129);
        mAllSewerIndex.Add(296);
        mAllSewerIndex.Add(66);
        //Hack
        mTurn1 = true;
        if (mPlayerIndex == DTileMap.TileType.Floor)
        {
            mPlayerIndex = DTileMap.TileType.Player1;
        }

        switch (mCharacter)
        {
        case Character.Anchorbeard:
            AnchorbeardPirate x1 = new AnchorbeardPirate();
            mAttack   = x1.mInputAttack;
            mDefence  = x1.mInputDefence;
            mMovement = x1.mInputMovement;
            mRange    = x1.mInputRange;
            break;

        case Character.Calamity:
            CalamityNinja x2 = new CalamityNinja();
            mAttack   = x2.mInputAttack;
            mDefence  = x2.mInputDefence;
            mMovement = x2.mInputMovement;
            mRange    = x2.mInputRange;
            break;

        case Character.Thordrann:
            ThordrannDwarf x3 = new ThordrannDwarf();
            mAttack   = x3.mInputAttack;
            mDefence  = x3.mInputDefence;
            mMovement = x3.mInputMovement;
            mRange    = x3.mInputRange;
            break;

        case Character.Weldington:
            WeldingtonAutomaton x4 = new WeldingtonAutomaton();
            mAttack   = x4.mInputAttack;
            mDefence  = x4.mInputDefence;
            mMovement = x4.mInputMovement + 3;
            mRange    = x4.mInputRange;
            break;
        }
        mInfamy      = 1;
        mPlayerPhase = PlayerPhase.Respawn;
        mMoved       = false;
        mPlayed      = false;
        mTurn        = false;
        Debug.Log("Player: Created");
    }