Exemplo n.º 1
0
 public void Start()
 {
     if (Player.Instance == null)
     {
         Player.Instance = this;
     }
 }
        public PlayerCamera(Player player, Camera camera)
        {
            MovementDanp = 8;
            RotationDanp = .5f;

            _player = player;
            _camera = camera;
        }
Exemplo n.º 3
0
 void Update()
 {
     if (_player == null) _player = FindObjectOfType<Player>();
     else
     {
         if(Math.Abs(Vector3.Distance(_player.transform.position, transform.position)) < Distance)
             _player.transform.position = Vector3.MoveTowards(
                 _player.transform.position,
                 transform.position,
                 Speed*Time.deltaTime);
     }
 }
        public PlayerController(Player player)
        {
            MaxVariableVelocity = 20;
            Acceleration = 70;
            VelocityDanp = 20;
            RotationSpeed = .03f;
            AfterBurnerModifier = 50;
            StrafeModifier = 7;

            MouseSensivity = new Vector2 (700, 700);
            UseRelativeMovement = false;

            _player = player;
        }
Exemplo n.º 5
0
        private void Start()
        {
            // get the components on the object we need ( should not be null due to require component so no need to check )
            Agent = GetComponentInChildren<NavMeshAgent>();
            Character = GetComponent<UnityStandardAssets.Characters.ThirdPerson.ThirdPersonCharacter>();

            Agent.updateRotation = true;
            Agent.updatePosition = true;

      
            SetEnemyInitalHealth(ThisEnemyType);

            _nonAiPlayer = GameObject.Find("Player").GetComponent<Player>();
            Target = GameObject.Find("Player").transform;

        }
        public void Start()
        {
            this.meteor = false;
            this.RespawnQueuePlayerOne = new Queue<int>();
            this.RespawnQueuePlayerTwo = new Queue<int>();

            this.PlayerOne = PlayerOneObject.GetComponent<Player>();
            this.PlayerTwo = PlayerTwoObject.GetComponent<Player>();

            this.PlayerOneSpawns = 0;
            this.PlayerTwoSpawns = 0;

            while (this.PlayerOneSpawns < Properties.MAX_ANIMALS)
                CalculateAndGenerateAnimal(Properties.FIRST_PLAYER);
            while (this.PlayerTwoSpawns < Properties.MAX_ANIMALS)
                CalculateAndGenerateAnimal(Properties.SECOND_PLAYER);

        }
Exemplo n.º 7
0
        void Update()
        {
            Money.text = "Money: {0}".ToFormat(Director.LevelMoney.ToString("C"));

            if (Director.IsDead && !_displayedScreen)
            {
                _displayedScreen = true;
                ShowPanel();
            }

            if (_player == null)
            {
                _player = GameObject.FindGameObjectWithTag("Player").GetComponent<Player>();
                ParachutesText.transform.parent.gameObject.SetActive(_player.RemainingParachutes > 0);
                RocketsText.transform.parent.gameObject.SetActive(_player.RemainingRockets > 0);
            }
            else
            {
                ParachutesText.text = "x {0}".ToFormat(_player.RemainingParachutes);
                RocketsText.text = "x {0}".ToFormat(_player.RemainingRockets);
                LivesText.text = "x {0}".ToFormat(_player.Health);
            }
        }
        private void Awake()
        {
            win = false;
            //We instantiate the playboard for both players and set it in a place so that both players can see
            playboardGO     = PhotonNetwork.Instantiate(playboardPrefab.name, new Vector3(0, 0, 0), Quaternion.identity);
            playboardGO.tag = "PlayBoardPanel";
            playboardGO.transform.SetParent(playboardContainer.transform, false);
            playboardGO.name = "PlayBoardPanel";
            //stateEmpty = true; // Flag to check if the state was empty

            //Same for the inputpanels
            inputpanelGO     = PhotonNetwork.Instantiate(inputPanelPrefab.name, new Vector3(0, 0, 0), Quaternion.identity);
            inputpanelGO.tag = "InputPanel";
            inputpanelGO.transform.SetParent(inputPanelContainer.transform, false);
            inputpanelGO.name = "InputPanel";

            // Setup the permission panel

            PhotonNetwork.AutomaticallySyncScene = true;

            //We instantiate the players and match state and save them locally
            player1    = new Assets.Scripts.Player(1, 0, true);
            player2    = new Assets.Scripts.Player(2, 0, false);
            matchState = new GameState(player1, player2);
            matchState.stateUpdate(inputpanelGO.GetComponent <InputPanelController>().inputBoxes);
            matchState.stateUpdate(playboardGO.GetComponent <PlayboardManager>().boxes);
            SaveSystem.Save(matchState);

            if (PhotonNetwork.LocalPlayer == PhotonNetwork.MasterClient)
            {
                inputButtonsContainer.SetActive(false);
                //inputpanelGO.SetActive(false);
            }


            currentPlayer = PhotonNetwork.PlayerListOthers[0];
        }
Exemplo n.º 9
0
        public void CreateCurrentPlayer(string name, string room)
        {
            Player newPlayer = new Player(name, room);

            this.CurrentPlayer = newPlayer;
        }
Exemplo n.º 10
0
 public void OnRemove(Player player)
 {
     foreach (var effect in Effects)
         player.RemoveEffect(effect);
 }
Exemplo n.º 11
0
 public void OnUpdate(Player player)
 {
     foreach (var effect in Effects)
         effect.OnUpdate(player);
 }
Exemplo n.º 12
0
 void Start()
 {
     _player = GameObject.Find("Player").GetComponent<Player>();
     _playerHealth = _player.PlayerHealth;
 }
Exemplo n.º 13
0
 public void OnAdd(Player player)
 {
     foreach (var effect in Effects)
         player.AddEffect(effect);
 }
        public void GrabAnimal(Player player, Animal animal)
        {

        }
Exemplo n.º 15
0
 public static void RegisterPlayer(string netID, Player player)
 {
     string playerID = PLAYER_ID_PREFIX + netID;
     _players.Add(playerID, player);
     player.transform.name = playerID;
 }
Exemplo n.º 16
0
 // Use this for initialization
 void Start()
 {
     _animator = GetComponent<Animator>();
     _player = GameObject.FindGameObjectWithTag("Player").GetComponent<Player>();
 }
Exemplo n.º 17
0
 // Use this for initialization
 void Start()
 {
     _point = transform.position + Vector3.one;
     _player = GameObject.FindGameObjectWithTag("Player").GetComponent<Player>();
     Audio = GetComponent<AudioSource>();
 }
Exemplo n.º 18
0
 public abstract void OnUpdate(Player player);
Exemplo n.º 19
0
 // Use this for initialization
 private void Start()
 {
     _player = GetComponentInParent<Player>();
 }
        public void KillPlayer(Player player)
        {
            int playerNumber = player.PlayerNumber;
            player.animator.SetTrigger("DeathTrigger");
            HUDManager.SetGameOver(playerNumber);

        }
        public void KillAnimal(Player player, int keyModifier)
        {

        }
        public void DropAnimal(Player player)
        {

        }
Exemplo n.º 23
0
 public abstract void OnAdd(Player player);
Exemplo n.º 24
0
 public void OnActivate(Player player)
 {
     player.UI.searchPanel.gameObject.SetActive(true);
     player.UI.searchPanel.ShowSearchMenu(Items, player);
     Items = new Dictionary<InventoryItem, int>();
 }
Exemplo n.º 25
0
 public abstract void OnRemove(Player player);
Exemplo n.º 26
0
 public void OnActivate(Player player)
 {
     isOpen = !isOpen;
     animator.SetBool("isOpen", isOpen);
     animator.SetTrigger("Activate");
 }
Exemplo n.º 27
0
 protected virtual void Start()
 {
     eventManager = GameObject.FindGameObjectWithTag("EventManager").GetComponent<EventManager>();
     player = GameObject.FindGameObjectWithTag("Player").GetComponent<Player>();
 }
Exemplo n.º 28
0
 // Use this for initialization
 void Start()
 {
     _image = GetComponent<Image>();
     _player = GameObject.FindGameObjectWithTag("Player").GetComponent<Player>();
 }