Exemplo n.º 1
0
 private void OnCollisionEnter(Collision collision)
 {
     if (collision.gameObject.tag.Equals("PickAxe"))
     {
         EnvironmentInteraction player = collision.gameObject.transform.parent.parent.parent.GetComponent <EnvironmentInteraction>();
         if (player.getHarvesting() && !audio.isPlaying)
         {
             audio.Play();
         }
     }
 }
Exemplo n.º 2
0
 private void OnCollisionExit(Collision collision)
 {
     if (collision.gameObject.tag.Equals("Axe"))
     {
         EnvironmentInteraction player = collision.gameObject.transform.parent.parent.parent.GetComponent <EnvironmentInteraction>();
         if (!player.getHarvesting())
         {
             audio.Stop();
         }
     }
 }
        public void AddNodule(EnvironmentInteraction env, GameObject nod)
        {
            nodules.Add(env, nod);
            var     pos         = spawnPosition.position;
            Vector3 startingPos = pos + (nodules.Count - 1) * -0.5f * Vector3.up;

            foreach (var obj in nodules)
            {
                obj.Value.transform.rotation = spawnPosition.rotation;
                obj.Value.transform.parent   = spawnPosition;
                obj.Value.transform.position = startingPos;
                startingPos += Vector3.up;
            }
        }
Exemplo n.º 4
0
    private void OnCollisionEnter(Collision collision)
    {
        //Debug.Log("Collision entered");

        //Debug.Log(collision.gameObject.transform.parent.parent.parent);
        //Debug.Log(collision.gameObject.transform.parent.parent.parent.GetComponent<EnvironmentInteraction>());
        if (collision.gameObject.tag.Equals("Axe"))
        {
            EnvironmentInteraction player = collision.gameObject.transform.parent.parent.parent.GetComponent <EnvironmentInteraction>();
            if (player.getHarvesting() && !audio.isPlaying)
            {
                //audio.PlayOneShot(harvestingClip);
                audio.Play();
            }
        }
    }
    /**
     * This is invoked when the challange is over (i.e. time run out).
     */
    void Start()
    {
        statman = FindObjectOfType(typeof(StatisticsManager)) as StatisticsManager;

        scoreText.text = statman.totalResources.ToString();

        // Pause the game
        Time.timeScale = 0;

        // Hide ingame gui to prevent interaction
        _inGameGui.SetActive(false);

        // Disable player -> environment interaction (sry for the hacky solution :((( ).
        EnvironmentInteraction environmentInteraction = FindObjectOfType(typeof(EnvironmentInteraction)) as EnvironmentInteraction;

        environmentInteraction.Activate(EnvironmentInteraction.EInteractionType.EEI_NONE);
        environmentInteraction.Deactivate(EnvironmentInteraction.EInteractionType.EEI_NONE);
    }
    void Awake()
    {
        _radioButton = GetComponent <RadioButton> ();

        _environmentInteraction = FindObjectOfType(typeof(EnvironmentInteraction)) as EnvironmentInteraction;
    }
Exemplo n.º 7
0
 private void Awake()
 {
     _interaction = (EnvironmentInteraction)target;
 }