상속: MonoBehaviour
예제 #1
0
        private void btnAddPlayer_Click(object sender, EventArgs e)
        {
            IPlayerManipulations playerLogic = new PlayerLogic();

            if (tbAddPlayerName.Text != "")
            {
                try
                {
                    playerLogic.AddOrUpdatePlayer(new PlayerType(tbAddPlayerMail.Text, tbAddPlayerName.Text, tbAddPlayerTag.Text));
                    tbAddPlayerMail.Text = "";
                    tbAddPlayerName.Text = "";
                    tbAddPlayerTag.Text  = "";
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Error: Add Player", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                MessageBox.Show("Player needs a name.", "Error: Add Player", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            UpdatePlayerList();
            UpdateTree();
        }
예제 #2
0
        public void GetOnePlayerTEST()
        {
            Mock <IRepository <Player> > mockedRepo = new Mock <IRepository <Player> >(MockBehavior.Loose);


            Player player = new Player()
            {
                IgazolasSzama = Guid.NewGuid().ToString(), PlayerName = "Van Dijk", Nationality = "Netherland", Rating = 90, WeakFoot = 2
            };
            Player expectedPlayer = new Player()
            {
                IgazolasSzama = player.IgazolasSzama,
                PlayerName    = player.PlayerName,
                Nationality   = player.Nationality,
                Rating        = player.Rating,
                WeakFoot      = player.WeakFoot
            };

            mockedRepo.Setup(repo => repo.Read(player.IgazolasSzama)).Returns(expectedPlayer);
            PlayerLogic playerlogic = new PlayerLogic(mockedRepo.Object);


            //ACT
            var result = playerlogic.GetPlayer(player.IgazolasSzama);

            //ASSERT
            Assert.That(result, Is.EqualTo(expectedPlayer));
        }
    // Use this for initialization
    void Start()
    {
        pos = transform.position;

        localScale = transform.localScale;
        player     = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerLogic>();
    }
예제 #4
0
        public static bool TrySetWinner()
        {
            Player winner = null;

            // Check if there is only one player left and therefore the winner of the game
            foreach (var player in Players)
            {
                if (!PlayerLogic.IsAlive(player))
                {
                    continue;
                }

                if (winner == null)
                {
                    winner = player;
                }
                else
                {
                    winner = null;
                    break;
                }
            }

            // More than 1 player alive, no winner
            if (winner == null)
            {
                return(false);
            }

            // 1 winner alive
            Winner = winner;
            return(true);
        }
예제 #5
0
        private void btnAddTeam_Click(object sender, EventArgs e)
        {
            IPlayerManipulations playerLogic = new PlayerLogic();
            ITeamManipulations   teamLogic   = new TeamLogic();
            List <PlayerType>    players     = new List <PlayerType>();

            if (tbTeamName.Text != "")
            {
                try
                {
                    for (int i = 0; i < clbPlayers.CheckedItems.Count; i++)
                    {
                        players.Add(playerLogic.GetPlayers()[clbPlayers.Items.IndexOf(clbPlayers.CheckedItems[i])]);
                    }
                    if (players.Count > 0)
                    {
                        teamLogic.AddOrUpdateTeam(new TeamType(tbTeamName.Text, players));
                        tbTeamName.Text = "";
                        UpdateTeamList();
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Error: Add Team", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                MessageBox.Show("Team needs a name.", "Error: Add Team", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            UpdateTree();
        }
예제 #6
0
        // Testing search criteria. Player with ID 2 should be at number 1 in the list because he match both criterias
        public void SearchForPlayersWithLeaugeAndPosition()
        {
            //Arrange
            var playerRepos = new Mock <IPlayerRepository <Player> >();
            //Setup search criterias
            SearchCriteriaForPlayer sc = new SearchCriteriaForPlayer {
                PrimaryPosition = "Playmaker",
                League          = "Second League"
            };

            playerRepos.Setup(x => x.GetBySearchCriteria(" p.isAvailable = 1 and p.league = 'Second League' and p.PrimaryPosition = 'Playmaker'"))
            .Returns(new List <Player>
            {
                new Player {
                    Id = 1, Country = "Denmark", League = "First League", PrimaryPosition = "Left back"
                },
                new Player {
                    Id = 2, Country = "Sweden", League = "Second League", PrimaryPosition = "Playmaker"
                },
                new Player {
                    Id = 3, Country = "Sweden", League = "Third League", PrimaryPosition = "Pivot"
                }
            });

            PlayerLogic pl = new PlayerLogic(playerRepos.Object);

            //Act
            var list = pl.HandleSearchAlgorithm(sc);

            Assert.Equal("Playmaker", list[0].PrimaryPosition);
        }
예제 #7
0
파일: Unstuck.cs 프로젝트: WOWZON3/TeraEMU
        public override void Process(IConnection connection, string msg)
        {
            try
            {
                if (msg.Length > 0)
                {
                    if (msg == "!!!")
                    {
                        Global.TeleportService.ForceTeleport(connection.Player, TeleportService.IslandOfDawnSpawn);
                        return;
                    }

                    for (int i = 0; i < connection.Account.Players.Count; i++)
                    {
                        if (connection.Account.Players[i].PlayerData.Name.Equals(msg.Trim(), StringComparison.OrdinalIgnoreCase))
                        {
                            var player = connection.Account.Players[i];
                            Global.TeleportService.ForceTeleport(player, TeleportService.IslandOfDawnSpawn);
                            return;
                        }
                    }
                }
                else
                {
                    PlayerLogic.Unstuck(connection);
                }
            }
            catch
            {
                //Nothing
            }
        }
예제 #8
0
    public void Start()
    {
        if (sr == null)
        {
            sr = GameObject.Find("BattleSetup").GetComponent <SetupRouter>();
        }
        moveDetection = new MoveDetection();

        pLogic = GetComponent <PlayerLogic>();
        tLogic = GetComponent <TrainerLogic>();



        spriteRenderer = GetComponent <SpriteRenderer>();

        if (pLogic != null)
        {
            logicType = LogicType.Player;
            endMove   = pLogic.MoveEnd;
        }
        else if (tLogic != null)
        {
            logicType = LogicType.Trainer;
            endMove   = tLogic.MoveEnd;
        }
        else
        {
            logicType = LogicType.NPC;
            endMove   = MoveEndStub;
        }
        moveSpeedCurrent = moveSpeed;
    }
예제 #9
0
        public void SearchForPlayersWithNoCriteria()
        {
            //Arrange
            var playerRepos            = new Mock <IPlayerRepository <Player> >();
            SearchCriteriaForPlayer sc = new SearchCriteriaForPlayer();

            playerRepos.Setup(x => x.GetAll())
            .Returns(new List <Player>
            {
                new Player {
                    Id = 1, Country = "Denmark"
                },
                new Player {
                    Id = 2, Country = "Sweden"
                },
                new Player {
                    Id = 3, Country = "Sweden"
                }
            });

            PlayerLogic pl = new PlayerLogic(playerRepos.Object);

            var list = pl.HandleSearchAlgorithm(sc);

            Assert.Equal(3, list.Count);
        }
예제 #10
0
    public PlayerStateData PlayerUpdate()
    {
        if (inputs.Length > 0)
        {
            PlayerInputData input = inputs.First();
            InputTick++;

            for (int i = 1; i < inputs.Length; i++)
            {
                InputTick++;
                for (int j = 0; j < input.Keyinputs.Length; j++)
                {
                    input.Keyinputs[j] = input.Keyinputs[j] || inputs[i].Keyinputs[j];
                }
                input.LookDirection = inputs[i].LookDirection;
            }

            currentPlayerStateData = PlayerLogic.GetNextFrameData(input, currentPlayerStateData);
        }

        PlayerStateDataHistory.Add(currentPlayerStateData);
        if (PlayerStateDataHistory.Count > 10)
        {
            PlayerStateDataHistory.RemoveAt(0);
        }

        transform.localPosition = currentPlayerStateData.Position;
        transform.localRotation = currentPlayerStateData.LookDirection;
        return(currentPlayerStateData);
    }
    void Start()
    {
        plLogic   = FindObjectOfType <PlayerLogic>();
        posGround = 45f;
        posRoof   = 25f;
        for (int i = 0; i < 5; i++)
        {
            int rand = Random.Range(1, 3);
            if (rand == 1)
            {
                Instantiate(HealthPoint1, new Vector3(0, 0.5f, posGround), Quaternion.identity);
            }
            posGround += 40;
        }

        for (int i = 0; i < 5; i++)
        {
            int rand = Random.Range(1, 3);
            if (rand == 1)
            {
                Instantiate(HealthPoint2, new Vector3(0, 2.5f, posRoof), Quaternion.identity);
            }
            posRoof += 100;
        }

        //myAudioSource1 = AddAudio(false, true, 0.7f);
        myAudioSource = AddAudio(false, true, 0.7f);
        // myAudioSource3 = AddAudio(false, true, 0.7f);
        //StartPlayingSounds();
        myAudioSource.clip = HealthPointSound;
        //myAudioSource2.clip = ObstacleSound;
        //myAudioSource3.clip = HealthPointSound;
    }
예제 #12
0
 // Called when the node enters the scene tree for the first time.
 public override void _Ready()
 {
     playerModel = (PlayerLogic)GetNode("/root/Main/LogicWorld/PlayerLogic");
     playerModel.Connect(nameof(PlayerLogic.GrowTail), this, nameof(onGrowTail));
     tail = new Array <Spatial>();
     tail.Add(this);
 }
예제 #13
0
        public void SetExp(Player player, long add, Npc npc)
        {
            int maxLevel = Data.Data.PlayerExperience.Count - 1;

            long maxExp = Data.Data.PlayerExperience[maxLevel - 1];
            int  level  = 1;

            if (add > maxExp)
            {
                add = maxExp;
            }

            while ((level + 1) != maxLevel && add >= Data.Data.PlayerExperience[level])
            {
                level++;
            }

            long added = add - player.Exp;

            if (level != player.Level)
            {
                player.Level = level;
                player.Exp   = add;
                PlayerLogic.LevelUp(player);
            }
            else
            {
                player.Exp = add;
            }

            new SpUpdateExp(player, added, npc).Send(player.Connection);
        }
예제 #14
0
 private void LoadGame()
 {
     Scene       = GameSave.LoadGameScene(this);
     PlayerStats = GameSave.LoadGameStats();
     HUD.Scene   = Scene;
     playerLogic = new PlayerLogic(this);
 }
예제 #15
0
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
 }
예제 #16
0
 public PlayerController(PlayerLogic playerLogic, IPlayerRepository <Player> playerRepos, Authentication authentication, UserManager <User> userManager)
 {
     _playerLogic        = playerLogic;
     _playerRepos        = playerRepos;
     this.authentication = authentication;
     this.userManager    = userManager;
 }
예제 #17
0
    private bool canHarmPlayer(GameObject player)
    {
        GameManager gameManger  = FindObjectOfType <GameManager>();
        PlayerLogic playerLogic = player.GetComponent <PlayerLogic>();

        return(!gameManger.isGameOver() && playerLogic.canBeChased && !playerLogic.isCaught()); //!playerLogic.isCaught() && playerLogic.canBeChased;
    }
예제 #18
0
 public void Action()
 {
     if (Funcs.GetCurrentMilliseconds() >= AutoRebirthUts)
     {
         PlayerLogic.Ressurect(Player, 0, -1);
     }
 }
예제 #19
0
        public async Task PlayerLogic_Login_Should_Return_Null_For_Known_Player_With_Wrong_Password()
        {
            // Arrange
            var          playerRepository = new Mock <IRepository <Player> >();
            IPlayerLogic playerLogic      = new PlayerLogic(playerRepository.Object, new PlayerMapper());
            var          player           = new Player
            {
                Name = "Player"
            };
            var login = new LoginDto
            {
                Name   = "Player",
                Secret = "Pa$$w0rd"
            };

            // Mock
            playerRepository.Setup(x => x.Single(Any.Predicate <Player>()))
            .ReturnsAsync((Expression <Func <Player, Boolean> > predicate) =>
                          new[] { player }.SingleOrDefault(predicate.Compile()));

            // Act
            var result = await playerLogic.Login(login);

            // Assert
            result.Should().BeNull();
        }
예제 #20
0
        public async Task PlayerLogic_GetAllPlayers_Should_Return_All_Players()
        {
            // Arrange
            var          playerRepository = new Mock <IRepository <Player> >();
            IPlayerLogic playerLogic      = new PlayerLogic(playerRepository.Object, new PlayerMapper());
            Player       player1          = new Player
            {
                Id     = Guid.NewGuid(),
                Name   = "Player1Name",
                Hashed = "Player1Secret"
            };
            Player player2 = new Player
            {
                Id     = Guid.NewGuid(),
                Name   = "Player2Name",
                Hashed = "Player2Secret"
            };

            // Mock
            playerRepository.Setup(x => x.GetAll()).ReturnsAsync(new[] { player1, player2 });

            // Act
            var result = await playerLogic.GetAllPlayers();

            // Assert
            result.Should().HaveCount(2);
            result.Should().ContainEquivalentOf(player1, properties => properties
                                                .Including(p => p.Id)
                                                .Including(p => p.Name));
            result.Should().ContainEquivalentOf(player2, properties => properties
                                                .Including(p => p.Id)
                                                .Including(p => p.Name));
        }
예제 #21
0
        public async Task PlayerLogic_Login_Should_Return_Known_Player()
        {
            // Arrange
            var          playerRepository = new Mock <IRepository <Player> >();
            IPlayerLogic playerLogic      = new PlayerLogic(playerRepository.Object, new PlayerMapper());
            var          player           = new Player
            {
                Name   = "Player",
                Salt   = "08IhqtPCEwbCSXj6LzduXA==",
                Hashed = "2aYxVxvAwYw4uT0ehZGC1CjHnwY3Wohyg8wu21zI5CM="
            };
            var login = new LoginDto
            {
                Name   = "Player",
                Secret = "Pa$$w0rd"
            };

            // Mock
            playerRepository.Setup(x => x.Single(Any.Predicate <Player>()))
            .ReturnsAsync((Expression <Func <Player, Boolean> > predicate) =>
                          new[] { player }.SingleOrDefault(predicate.Compile()));

            // Act
            var result = await playerLogic.Login(login);

            // Assert
            result.Should().NotBeNull();
            result.Name.Should().Be(player.Name);
        }
예제 #22
0
 public void Start(Player player)
 {
     Player        = player;
     Player.Target = null;
     Player.LifeStats.Kill();
     PlayerLogic.PleyerDied(player);
 }
예제 #23
0
 void Start()
 {
     game         = GameBehaviour.Instance;
     camera_obj   = GetComponent <Camera>();
     player_body  = player.GetComponent <Rigidbody2D>();
     player_logic = player.GetComponent <PlayerLogic>();
 }
예제 #24
0
 void Start()
 {
     player       = GameObject.Find("Player");
     playerScript = player.GetComponent <PlayerLogic>();
     boxCollider  = GetComponent <BoxCollider2D>();
     Destroy(this.gameObject, TimeToLive);
 }
예제 #25
0
 void Awake()
 {
     inventoryData = this.gameObject.GetComponent<InventoryData>();
     inventoryLogic = this.gameObject.GetComponent<InventoryLogic>();
     playerData = GameObject.Find("Player").GetComponent<PlayerData>();
     playerLogic = GameObject.Find("Player").GetComponent<PlayerLogic>();
 }
예제 #26
0
        //*********************************************************************************************
        // LoginAnswer / Revisto pela última vez em 01/08/2016, criado por Allyson S. Bacon
        //*********************************************************************************************
        public static string LoginAnswer(string[] data, int s)
        {
            //EXTEND
            if (Extensions.ExtensionApp.extendMyApp
                    (MethodBase.GetCurrentMethod().Name, data, s) != null)
            {
                return(Extensions.ExtensionApp.extendMyApp
                           (MethodBase.GetCurrentMethod().Name, data, s).ToString());
            }

            //CÓDIGO
            string password = data[1];

            Console.WriteLine(lang.login + " " + data[0]);
            Console.WriteLine(lang.password + " " + password);
            if (Database.Accounts.tryLogin(s, data[0], password))
            {
                if (PlayerLogic.isPlayerConnected(data[0]) == true)
                {
                    return("c");
                }
                else
                {
                    PlayerStruct.player[s].Email = data[0];
                    Log(lang.player_authenticated + ": " + data[0] + " / " + password);
                    return("a");
                }
            }
            else
            {
                return("p");
            }
        }
예제 #27
0
        public static MoveStatus MovCommand(int userId, Direction direction)
        {
            Lobby lobby         = LobbyRepository.Read(0);
            var   currentPlayer = lobby.Players.Find(e => e.TelegramUserId == userId);
            var   actionList    = PlayerLogic.TryMove(lobby, currentPlayer, direction);

            LobbyRepository.Update(lobby);
            FormatAnswers.ConsoleApp(lobby);
            if (actionList.Contains(PlayerAction.GameEnd))
            {
                return(new MoveStatus
                {
                    IsGameEnd = true,
                    CurrentPlayer = currentPlayer,
                    PlayerActions = actionList
                });
            }

            MoveStatus status = new MoveStatus
            {
                IsOtherTurn   = false,
                IsGameEnd     = false,
                CurrentPlayer = currentPlayer,
                PlayerActions = actionList
            };

            return(status);
        }
예제 #28
0
 public override void Initialize()
 {
     this.Logic          = new PlayerLogic();
     this.HasModSettings = false;
     this.HasSessionData = false;
     this.IsSynced       = false;
 }
예제 #29
0
        ////

        public override void OnRespawn(Player player)
        {
            if (PlayerLogic.IsHoldingGun(this.player))
            {
                ((TheMadRangerItem)player.HeldItem.modItem).InsertAllOnRespawn(player);
            }
        }
예제 #30
0
        public void PlayerLogicMakesCorrectFirstMoveTowardsTasksField()
        {
            var connection = A.Fake <Connection>(o => o.WithArgumentsForConstructor(
                                                     new object[] { "127.0.0.1", 8002, "testGame", playerParameters, new object() }));
            PlayerLogic logic = new PlayerLogic(connection);

            logic.Board = logic.CreateInitialBoard(goalsHeight, tasksHeight, boardWidth);

            Game gameMessage = new Game();

            gameMessage.playerId = 0;
            List <Xsd2.Player> players = new List <Xsd2.Player>();

            Xsd2.Player player = new Xsd2.Player();
            players.Add(new Xsd2.Player(0, TeamColour.blue, PlayerType.member));
            gameMessage.Players           = players.ToArray();
            gameMessage.Board             = new GameBoard();
            gameMessage.Board.width       = (uint)boardWidth;
            gameMessage.Board.tasksHeight = (uint)tasksHeight;
            gameMessage.Board.goalsHeight = (uint)goalsHeight;
            gameMessage.PlayerLocation    = new Location();
            gameMessage.PlayerLocation.x  = 0;
            gameMessage.PlayerLocation.y  = 0;

            GameMessage msg = logic.AnswerForGameMessage(connection, gameMessage);

            // Since we create agent in the bottom, direction is up)
            Assert.AreEqual(MoveType.up, (msg as Move).direction);
        }
예제 #31
0
 public HomeController(PlayerLogic playerlogic, LeagueLogic leaguelogic, TeamLogic teamlogic, StatLogic statLogic)
 {
     this.playerlogic = playerlogic;
     this.leaguelogic = leaguelogic;
     this.teamlogic   = teamlogic;
     this.statLogic   = statLogic;
 }
 public void Reset(Vector3 position, Vector2 velocity, float angularSpeed, PlayerLogic player)
 {
     gameObject.SetActive(true);
     transform.position = position;
     transform.localScale = coinScale;
     body.velocity = velocity;
     body.angularVelocity = angularSpeed;
     body.isKinematic = false;
     trigger.Reset();
 }
예제 #33
0
    void Awake()
    {
        _audioSource = Camera.main.GetComponent<AudioSource>();
        _playerlogic = GetComponent<PlayerLogic>();
        _transform = GetComponent<Transform>();
        SetPosition();
        _sphereCollider = GetComponent<SphereCollider>();
        _lineRenderer = GetComponent<LineRenderer>();
        _springJoint = GetComponent<SpringJoint>();
        _meshRenderer = GetComponent<MeshRenderer>();
        _material = _meshRenderer.material;

        _lineRenderer.SetVertexCount(2);
    }
예제 #34
0
        //private GameObject markerObj;
        //private GUITexture lockOnMarker;
        // Use this for initialization
        void Start()
        {
            aspectRatio = Screen.width / Screen.height;
            playerLogic = GetComponent<PlayerLogic>();
            //actorCtrl = playerLogic.ActorCtrl;
            //if(playerLogic.ActorCtrl != null)
            //{
            //}
            //the healthbar fill textures will be stretched to fill a rect, so they only need to be 1x1 textures
            healthbarFill = new Texture2D(1, 1, TextureFormat.RGB24, false);
            healthbarFill.SetPixel(0, 0, Color.red);
            healthbarFill.Apply();
            healthbarHealthFill = new Texture2D(1, 1, TextureFormat.RGB24, false);
            healthbarHealthFill.SetPixel(0, 0, Color.green);
            healthbarHealthFill.Apply();

            //we'd like to log player kills
            EventManager.AddListener(EventType.ActorKilled, this);
        }
예제 #35
0
    void Start()
    {
        boxCollider = GetComponent<BoxCollider2D>();
        animator = sprite.GetComponent<Animator>();
        playerLogic = GetComponent<PlayerLogic>();

        isGrounded = false;
        isTouchingWall = false;
        doubleJump = false;
        onSlope = false;
        ControlsEnabled = true;
        notGroundedCountdown = 0;
        runningMotrSpeed = 0;
        relativeJumpSpeed = jumpSpeed;
        HorizontalMovmentDirection = Vector2.right * Mathf.Sign(velocity.x);

        jumpingCountdown = Mathf.NegativeInfinity;
        disableControlsCountdown = Mathf.NegativeInfinity;
        ParachuteCountdown = Mathf.Infinity;

        jumpKeyReleased = true;
        usingParachute = false;
        parachuteScale = 0;

        windZoneAcceleration = 0;
        windZoneMaxSpeed = 0;

        input = 0;
        jumpSpeed = jumpSpeedMin;

        movablePlatform = null;

        speedAnimHash = Animator.StringToHash("Speed");
        jumpAnimHash = Animator.StringToHash("Jump");
        doubleJumpAnimHash = Animator.StringToHash("DoubleJump");
        fallingSpeedAnimHash = Animator.StringToHash("FallingSpeed");
        isGroundedAnimHash = Animator.StringToHash("IsGrounded");
        wallSlidingAnimHash = Animator.StringToHash("IsWallSliding");
    }
예제 #36
0
 // Use this for initialization
 void Start()
 {
     currentCooldownTime = 0;
     playerHealth = (PlayerLogic)Player.gameObject.GetComponent(typeof(PlayerLogic));
 }
예제 #37
0
    // Use this for initialization
    void Start()
    {
        #region Localization
        LanguageManager languageManager=LanguageManager.Instance;

        localizationRestart  = languageManager.GetTextValue("MainScene.Restart");
        localizationGameMenu = languageManager.GetTextValue("MainScene.GameMenu");
        localizationGameOver = languageManager.GetTextValue("MainScene.GameOver");
        #endregion

        #region Create text styles
        topLeftTextStyle  = new GUIStyle();
        topRightTextStyle = new GUIStyle();
        centerTextStyle   = new GUIStyle();

        topLeftTextStyle.alignment=TextAnchor.UpperLeft;
        topLeftTextStyle.clipping=TextClipping.Overflow;
        topLeftTextStyle.fontSize=(int)(Screen.height*0.075);
        topLeftTextStyle.normal.textColor=Color.white;

        topRightTextStyle.alignment=TextAnchor.UpperRight;
        topRightTextStyle.clipping=TextClipping.Overflow;
        topRightTextStyle.fontSize=(int)(Screen.height*0.075);
        topRightTextStyle.normal.textColor=Color.white;

        centerTextStyle.alignment=TextAnchor.MiddleCenter;
        centerTextStyle.clipping=TextClipping.Overflow;
        centerTextStyle.fontSize=(int)(Screen.height*0.075);
        centerTextStyle.normal.textColor=Color.white;
        #endregion

        // ---------------------------------------------------------------

        #region Get controllers
        playerLogic  = player.GetComponent<PlayerLogic>();
        player2Logic = enemy.GetComponent<PlayerLogic>();
        enemyAI      = enemy.GetComponent<EnemyAI>();
        #endregion

        #region Get difficulty from arguments
        Hashtable arguments=SceneManager.sceneArguments;

        if (arguments!=null && arguments.ContainsKey("difficulty"))
        {
            difficulty=(int)arguments["difficulty"];
        }
        else
        {
            difficulty=0;
        }
        #endregion

        #region Setup controllers
        if (difficulty>=0) // Single player
        {
            enemyAI.maxSpeed=10+difficulty*10;

            enemyAIMode = true;
        }
        else
        if (difficulty==-1) // Multiplayer
        {
            if (Network.isServer) // Server side
            {
                playerLogic.playerMode  = PlayerLogic.Mode.BothPlayers;
                player2Logic.playerMode = PlayerLogic.Mode.RightPlayer;
            }
            else
            if (Network.isClient) // Client side
            {
                playerLogic.playerMode  = PlayerLogic.Mode.LeftPlayer;
                player2Logic.playerMode = PlayerLogic.Mode.BothPlayers;
            }
            else // 2 players
            {
                playerLogic.playerMode  = PlayerLogic.Mode.LeftPlayer;
                player2Logic.playerMode = PlayerLogic.Mode.RightPlayer;
            }

            enemyAIMode = false;
        }
        #endregion

        init();
    }
예제 #38
0
 void Start()
 {
     playerScript = GetComponent<PlayerLogic>();
     //rgdbdy = playerTransform.GetComponent<Rigidbody>(); rgdbdy.velocity.y != 0;
 }
예제 #39
0
 void Awake()
 {
     playerLogic = player.GetComponent<PlayerLogic>();
     turnSide = Mathf.FloorToInt(cameraController.transform.eulerAngles.y/90);
     currentRoom = new RoomPiece[2]{testRoom, testRoom2};
 }
예제 #40
0
 // Use this for initialization
 void Start()
 {
     S = this;
     normal = playerRenderer.material.color;
     normalRotation = playerModel.transform.rotation;
 }
예제 #41
0
    void Start()
    {
        currentDistance = distance;
        desiredDistance = distance;
        correctedDistance = distance;

        var angles = transform.eulerAngles;
        x = angles.y;
        y = angles.x;

        ps = GetComponentInParent<PlayerStats>();
        pl = GetComponentInParent<PlayerLogic>();
    }
예제 #42
0
 /// <summary>
 /// Tie this HUD to a player's PlayerStats.cs script to visualize the correct player
 /// </summary>
 /// <param name="playerStats"></param>
 public void SetPlayerStats(PlayerStats playerStats)
 {
     ps = playerStats;
     pl = playerStats.GetComponent<PlayerLogic>();
     playerNameText.text = "";
     pl.CmdWhatNumberAmI();
     // Turn off world-space healthBar
     ps.GetComponentInChildren<Canvas>().enabled = false;
     #region Abilities
     try {
         ability1.sprite = ps.abilities[0].Icon;
         actionBar.GetComponentsInChildren<Image>()[0].sprite = ps.abilities[0].Icon;
         ability2.sprite = ps.abilities[1].Icon;
         actionBar.GetComponentsInChildren<Image>()[2].sprite = ps.abilities[1].Icon;
         ability3.sprite = ps.abilities[2].Icon;
         actionBar.GetComponentsInChildren<Image>()[4].sprite = ps.abilities[2].Icon;
         SetTooltips();
     } catch { Debug.Log("Actionbar (automatic) setup for abilities failed.."); }
     #endregion
     #region Inventory
     //Activate Inventory GO
     inventory.gameObject.SetActive(true);
     //Set count status text
     inventory.transform.FindChild("Banana").GetComponentInChildren<Text>().text = "" + inventory.GetComponent<Inventory>().bananaCount;
     inventory.transform.FindChild("Stick").GetComponentInChildren<Text>().text = "" + inventory.GetComponent<Inventory>().stickCount;
     inventory.transform.FindChild("Sap").GetComponentInChildren<Text>().text = "" + inventory.GetComponent<Inventory>().stickCount;
     inventory.transform.FindChild("Leaf").GetComponentInChildren<Text>().text = "" + inventory.GetComponent<Inventory>().stickCount;
     inventory.transform.FindChild("BerryR").GetComponentInChildren<Text>().text = "" + inventory.GetComponent<Inventory>().berryRCount;
     inventory.transform.FindChild("BerryG").GetComponentInChildren<Text>().text = "" + inventory.GetComponent<Inventory>().berryGCount;
     inventory.transform.FindChild("BerryB").GetComponentInChildren<Text>().text = "" + inventory.GetComponent<Inventory>().berryBCount;
     #endregion
     // TODO: Do stuff with setting up correct ability images
     SetCursorState(true);
     if (miniMap) foreach (MinimapBlip mmb in miniMap.GetComponentsInChildren<MinimapBlip>()) Destroy(mmb.gameObject); //Removes previous icons if players reconnect (important when they swap teams)
     SetupMiniMap(playerStats.transform);
 }