private void InitializePlayer() { this.trans = transform; this.navMeshAgent = gameObject.GetComponent <NavMeshAgent>(); this.windowManager = gameObject.GetComponent <PlayerGUIWindowManager>(); this.modules = new AModule <APlayer>[] { (this.objects = new PlayerGameObjects <APlayer>()), this.attributes, this.items, (this.interactions = new PlayerInteractions <APlayer>()), (this.animations = new PlayerAnimation <APlayer>()), (this.movement = new PlayerMovement <APlayer>()), this.skills, (this.userInterfaceInformations = new PlayerUserInterfaceInformations <APlayer>()), (this.collisions = new PlayerCollisions <APlayer>()), (this.jobs = new PlayerJobManager <APlayer>()), }; for (short i = 0; i < this.modules.Length; i++) { this.modules[i].Initialize(this); } this.windowManager.InitializeByPlayer(); }
public new void Awake() { base.Awake(); rb = GetComponent <Rigidbody2D>(); playerI = new PlayerInteractions(); self_PlayerUI.Invetnroy = self_UnitInventory; }
public void OnInteract(GameObject playerobject) { playerInteractions = playerobject.GetComponent <PlayerInteractions>(); if (playerInteractions.player == player)//Get vegetable chopped { if (playerInteractions.GetVegetable(0) != null) { if (combination == null) { combination = playerInteractions.RemoveVegetable(); } else { combination += "," + playerInteractions.RemoveVegetable(); } playerInteractions.StartCooking(); } else if (playerInteractions.GetVegetable(0) == null && playerInteractions.combination == null && combination != null)//pickup up combo { playerInteractions.combination = combination; combination = null; } else if (playerInteractions.GetVegetable(0) == null && playerInteractions.combination != null && combination == null)//place combo on choppingboard { combination = playerInteractions.combination; playerInteractions.combination = null; } } }
public void ButtonPress(PlayerInteractions interaction) { Waiting = false; if (RequiredInteraction == interaction) { //pass //get new target interaction RequiredInteraction = (PlayerInteractions)Random.Range(0, 4); Camera.main.backgroundColor = GetColorForInteration(RequiredInteraction); _iScore += 1; Score.text = _iScore.ToString(); //update timer _currentTime = 0; CurrentAllowedTime -= DifferencePerScore; if (CurrentAllowedTime < MinTime) { CurrentAllowedTime = MinTime; } } else { //gameover? ResetProgress(); } }
private void Start() { _counterController = FindObjectOfType <PlayerCounterController>(); _playerMovement = GetComponent <PlayerMovement>(); _playerInteractions = GetComponent <PlayerInteractions>(); }
// Start is called before the first frame update void Start() { canMove = true; rigidbody = gameObject.GetComponent <Rigidbody2D>(); playerInteractions = gameObject.GetComponent <PlayerInteractions>(); speed = GameConstants.MovementOffset; }
void OnTriggerEnter(Collider other) { player = other.GetComponent <PlayerInteractions>(); if (interactable && player != null) { OnTrigger(player); } }
public virtual void OnTrigger(PlayerInteractions player) { Debug.Log("Trigger function is not set-up."); for (int i = 0; i < actions.Length; i++) { actions[i].Invoke(); } }
// Start is called before the first frame update public void SetUi(PlayerInteractions interactions) { playerInteractions = interactions; CurrentTime = 0; CurrentScore = 0; ScoreText = transform.Find("Score").GetComponent <Text>(); TimeText = transform.Find("Time").GetComponent <Text>(); ResetScore(); }
public override void Interact(PlayerInteractions player) { if (player.Inventory.IsFull()) { Debug.Log("Inventory full"); return; } player.TakeItem(item); }
public void OnInteract(GameObject playerobject) { playerInteractions = playerobject.GetComponent <PlayerInteractions>(); if (playerInteractions.player == Player) { playerInteractions.GetUI.AddScore(GameConstants.ScorePickUp); Destroy(gameObject); } }
void OnTriggerEnter(Collider other) { player = other.GetComponent <PlayerInteractions>(); if (interactable && player != null) { interacted = true; player.actions += Interact; } }
public void OnInteract(GameObject playerobject) { playerInteractions = playerobject.GetComponent <PlayerInteractions>(); if (playerInteractions.player == Player) { playerInteractions.IncreaseSpeed(); Destroy(gameObject); } }
//AudioSource audio; //public AudioClip attacking, takeDamage, spawned, inRange, stun, died; private void Awake() { enemySoundbank = GetComponentInChildren <EnemySoundbank>(); navAgent = GetComponent <NavMeshAgent>(); //audio = GetComponent<AudioSource>(); Player = GameObject.FindGameObjectWithTag("PlayerBody").transform; playerScript = FindObjectOfType <PlayerInteractions>(); currentHealth = maxHealth; stunned = false; dead = false; }
void Awake() { Interactions = gameObject.GetComponent <PlayerInteractions>(); CombatManager = gameObject.GetComponent <CombatManager>(); SelectedText.color = Color.white; TargetText.color = Color.white; CombatText.color = Color.white; SelectedText.text = ""; TargetText.text = ""; CombatText.text = ""; }
public void OnInteract(GameObject playerobject) { playerInteractions = playerobject.GetComponent <PlayerInteractions>(); if (playerInteractions.combination != null) { playerInteractions.combination = null; playerInteractions.GetUI.AddScore(GameConstants.combinationtrash); } else if (playerInteractions.GetVegetable(0) != null) { playerInteractions.RemoveVegetable(); playerInteractions.GetUI.AddScore(GameConstants.vegetabletrash); } }
//Internal Methods protected override IEnumerator ModifierEffect() { player = FindObjectOfType <PlayerInteractions>(); player.SetGhostMode(true); float timer = 0f; while (timer <= modifierDuration) { timer += Time.deltaTime / Time.timeScale; yield return(null); } player.SetGhostMode(false); ExpireModifier(); }
public void OnInteract(GameObject playerobject) { playerInteractions = playerobject.GetComponent <PlayerInteractions>(); if (playerInteractions.player == this.player) { if (vegetable == null && playerInteractions.GetVegetable(0) != null) { vegetable = playerInteractions.RemoveVegetable(); } else if (playerInteractions.GetVegetable(1) == null) { playerInteractions.AddVegetable(vegetable); vegetable = null; } } }
public void SetPlayerFinished(PlayerInteractions playerInteractions) { if (playerInteractions.player == GameConstants.Players.Player1) { player1finished = true; } if (playerInteractions.player == GameConstants.Players.Player2) { player2finished = true; } if (player1finished == true && player2finished == true) { SceneManager.LoadScene(2); GameConstants.Player1Score = player1.GetComponent <PlayerInteractions>().GetUI.CurrentScore; GameConstants.Player2Score = player2.GetComponent <PlayerInteractions>().GetUI.CurrentScore; } }
virtual protected void Start() { GameManager.current.playerRef = gameObject; playerAnim = GetComponent <Animator>(); playerStats = GetComponent <PlayerStats>(); playerInteractions = GetComponent <PlayerInteractions>(); playerMovement = GetComponent <PlayerMovement>(); playerCamera = Camera.main; gameManager = GameManager.current; gameUIManager = GameUIManager.currentInstance; InitiatePlayer(); UIManager.current.PlayerSpawned(this); itemsList = new List <PlayerItem>(); }
public void OnInteract(GameObject playerobject) { playerInteractions = playerobject.GetComponent <PlayerInteractions>(); if (playerInteractions.combination != null) { if (SameCombination(combination, playerInteractions.combination)) { Debug.Log("correct item"); CorrectCombination(); } else { Debug.Log("wrong item"); WrongItem(); } playerInteractions.combination = null; } }
public void SpawnPickUp(PlayerInteractions playerInteractions) { float randomPosX = Random.Range(colliderPos.x - Boxcollider.size.x / 2, colliderPos.x + Boxcollider.size.x / 2); float randomPosY = Random.Range(colliderPos.y - Boxcollider.size.y / 2, colliderPos.y + Boxcollider.size.y / 2); GameObject SpawnItem = PickUpPrefabs[Random.Range(0, PickUpPrefabs.Length)]; GameObject instantiatedObject = Instantiate(SpawnItem, new Vector3(randomPosX, randomPosY), Quaternion.identity, GameObject.FindGameObjectWithTag("Canvas").transform); if (instantiatedObject.tag == "ScorePickup") { ScorePowerUp scorePowerUp = instantiatedObject.GetComponent <ScorePowerUp>(); scorePowerUp.playerInteractions = playerInteractions; scorePowerUp.SetUi(); } else if (instantiatedObject.tag == "TimePowerUp") { TimePoweUp timePoweUp = instantiatedObject.GetComponent <TimePoweUp>(); timePoweUp.playerInteractions = playerInteractions; timePoweUp.SetUi(); } }
private void Awake() { rigidbody = GetComponent <Rigidbody>(); interactionScript = GetComponent <PlayerInteractions>(); }
public PlayerInteractionEventArgs(PlayerInteractions playerInteraction, string artistName, string trackTitle) { this.PlayerInteraction = playerInteraction; this.ArtistName = artistName; this.TrackTitle = trackTitle; }
public Color GetColorForInteration(PlayerInteractions interaction) { return(InteractionColors[(int)interaction].Color); }
public virtual void Interact(PlayerInteractions player) { return; }
void Awake() { _seed = (int)DateTime.Now.Ticks; _random = new Random(_seed); _interactions = gameObject.GetComponent <PlayerInteractions>(); }
public override void Interact(PlayerInteractions player) { Debug.Log("Talking"); player.Talk(true); }
// Start is called before the first frame update void Start() { pInteractions = GetComponent <PlayerInteractions>(); pMovement = GetComponent <PlayerMovement>(); IsPaused = false; }
void Start() { player = FindObjectOfType <Player>().GetComponent <Player>(); playerInteractions = FindObjectOfType <Player>().GetComponent <PlayerInteractions>(); gameObject.SetActive(false); }