Пример #1
0
    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();
    }
Пример #2
0
 public new void Awake()
 {
     base.Awake();
     rb      = GetComponent <Rigidbody2D>();
     playerI = new PlayerInteractions();
     self_PlayerUI.Invetnroy = self_UnitInventory;
 }
Пример #3
0
 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;
         }
     }
 }
Пример #4
0
 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();
     }
 }
Пример #5
0
    private void Start()
    {
        _counterController = FindObjectOfType <PlayerCounterController>();

        _playerMovement     = GetComponent <PlayerMovement>();
        _playerInteractions = GetComponent <PlayerInteractions>();
    }
Пример #6
0
 // Start is called before the first frame update
 void Start()
 {
     canMove            = true;
     rigidbody          = gameObject.GetComponent <Rigidbody2D>();
     playerInteractions = gameObject.GetComponent <PlayerInteractions>();
     speed = GameConstants.MovementOffset;
 }
Пример #7
0
 void OnTriggerEnter(Collider other)
 {
     player = other.GetComponent <PlayerInteractions>();
     if (interactable && player != null)
     {
         OnTrigger(player);
     }
 }
Пример #8
0
 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();
     }
 }
Пример #9
0
 // 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();
 }
Пример #10
0
 public override void Interact(PlayerInteractions player)
 {
     if (player.Inventory.IsFull())
     {
         Debug.Log("Inventory full");
         return;
     }
     player.TakeItem(item);
 }
Пример #11
0
 public void OnInteract(GameObject playerobject)
 {
     playerInteractions = playerobject.GetComponent <PlayerInteractions>();
     if (playerInteractions.player == Player)
     {
         playerInteractions.GetUI.AddScore(GameConstants.ScorePickUp);
         Destroy(gameObject);
     }
 }
Пример #12
0
 void OnTriggerEnter(Collider other)
 {
     player = other.GetComponent <PlayerInteractions>();
     if (interactable && player != null)
     {
         interacted      = true;
         player.actions += Interact;
     }
 }
Пример #13
0
 public void OnInteract(GameObject playerobject)
 {
     playerInteractions = playerobject.GetComponent <PlayerInteractions>();
     if (playerInteractions.player == Player)
     {
         playerInteractions.IncreaseSpeed();
         Destroy(gameObject);
     }
 }
Пример #14
0
    //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;
    }
Пример #15
0
        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   = "";
        }
Пример #16
0
 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);
     }
 }
Пример #17
0
        //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();
        }
Пример #18
0
 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;
         }
     }
 }
Пример #19
0
 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>();
    }
Пример #21
0
 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;
     }
 }
Пример #22
0
    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();
        }
    }
Пример #23
0
 private void Awake()
 {
     rigidbody         = GetComponent <Rigidbody>();
     interactionScript = GetComponent <PlayerInteractions>();
 }
Пример #24
0
 public PlayerInteractionEventArgs(PlayerInteractions playerInteraction, string artistName, string trackTitle)
 {
     this.PlayerInteraction = playerInteraction;
     this.ArtistName        = artistName;
     this.TrackTitle        = trackTitle;
 }
Пример #25
0
 public Color GetColorForInteration(PlayerInteractions interaction)
 {
     return(InteractionColors[(int)interaction].Color);
 }
Пример #26
0
 public virtual void Interact(PlayerInteractions player)
 {
     return;
 }
Пример #27
0
 void Awake()
 {
     _seed         = (int)DateTime.Now.Ticks;
     _random       = new Random(_seed);
     _interactions = gameObject.GetComponent <PlayerInteractions>();
 }
Пример #28
0
 public override void Interact(PlayerInteractions player)
 {
     Debug.Log("Talking");
     player.Talk(true);
 }
Пример #29
0
 // Start is called before the first frame update
 void Start()
 {
     pInteractions = GetComponent <PlayerInteractions>();
     pMovement     = GetComponent <PlayerMovement>();
     IsPaused      = false;
 }
Пример #30
0
 void Start()
 {
     player             = FindObjectOfType <Player>().GetComponent <Player>();
     playerInteractions = FindObjectOfType <Player>().GetComponent <PlayerInteractions>();
     gameObject.SetActive(false);
 }