protected void OnTriggerEnter2D(Collider2D collision)
    {
        if (currentTask == TaskTypes.Joy)
        {
            JoyZone zoneJoy = collision.GetComponent <JoyZone>();
            if (zoneJoy != null)
            {
                if (zoneJoy.areaFull)
                {
                    fullJoyZones.Add(zoneJoy);
                    Transform newPos = FindJoyLocation();
                    SetTarget(newPos);
                }
            }
        }

        if (currentTask == TaskTypes.Social)
        {
            InteractionZone zoneInteraction = collision.GetComponent <InteractionZone>();
            if (zoneInteraction != null)
            {
                if (zoneInteraction.areaFull)
                {
                    fullInteractionZones.Add(zoneInteraction);
                    Transform newPos = FindInteractionLocation();
                    SetTarget(newPos);
                }
            }
        }
    }
    void Start()
    {
        attracter   = GetComponent <PlanetAttracter>();
        aligner     = GetComponent <PlanetSurfaceAligner>();
        rb          = GetComponent <Rigidbody>();
        interaction = GetComponentInChildren <InteractionZone>();

        jetpackCharge = jetpackCapacity;
    }
示例#3
0
    private void OnTriggerExit2D(Collider2D other)
    {
        Component zone = other.GetComponent("InteractionZone");

        if (zone != null)
        {
            interactZone.deactivate(stats);
            interactZone = null;
        }
    }
    private void Start()
    {
        sacoAudio.volume *= Globals.SOUND_GENERAL_SLIDER;

        this.transform.rotation.SetLookRotation(new Vector3(0, 0, 1));

        //gets de script sound
        audioPlay = GetComponent <ScriptSound>();

        m_throwArc.SetActive(false);
        m_Crosshair.SetActive(false);

        m_Camera  = Camera.main;
        oS_Camera = oS_CameraGo.GetComponent <Camera>();
        oS_CameraGo.SetActive(false);

        //animation
        anim = GetComponent <Control_Anim>();

        //Gets the Feet Script from the feet child
        feetScript = feetCollider.GetComponent <Feet>();

        //Making sure the secondary camera is off
        hideCameraRef.SetActive(false);

        //player rigidBody
        rb = this.GetComponent <Rigidbody>();

        if (playerCamera == null)
        {
            playerCamera = Camera.main.gameObject;
        }

        // get the transform of the main camera
        if (Camera.main != null)
        {
            m_Cam = Camera.main.transform;
        }

        // get the third person character ( this should never be null due to require component )
        m_Character = GetComponent <ThirdPersonCharacter>();

        m_soundManager = GameObject.FindWithTag("GameController").GetComponent <SoundManager>();

        interactionScript = playerInteractionZone.GetComponent <InteractionZone>();

        if (m_AudioSource == null)
        {
            m_AudioSource = this.GetComponent <AudioSource>();
        }
        m_AudioSource.volume *= Globals.SOUND_FX_SLIDER;
    }
示例#5
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.gameObject.layer == Constants.StationLayer)
     {
         _isInside = true;
         ForegroundFlakes.SetActive(false);
     }
     else if (collision.gameObject.layer == Constants.InteractionLayer)
     {
         _interactionZone     = collision.gameObject.GetComponent <InteractionZone>();
         InteractionText.text = ">" + _interactionZone.Description;
     }
 }
示例#6
0
 private void OnTriggerExit2D(Collider2D collision)
 {
     if (collision.gameObject.layer == Constants.StationLayer)
     {
         _isInside = false;
         ForegroundFlakes.SetActive(true);
     }
     else if (collision.gameObject.layer == Constants.InteractionLayer)
     {
         _interactionZone     = null;
         InteractionText.text = string.Empty;
     }
 }
示例#7
0
    private void Awake()
    {
        if (Instance == null)
        {
            Instance = this;
            DontDestroyOnLoad(gameObject);
        }
        else if (Instance != this)
        {
            Destroy(gameObject);
        }



        _rb   = GetComponent <Rigidbody>();
        zone  = attackZone.GetComponent <AttackZone>();
        Izone = InteractZone.GetComponent <InteractionZone>();
        InteractSprite.SetActive(false);
        attackZone.SetActive(false);
        Hud.TransiOut();
    }
    protected Transform FindInteractionLocation()
    {
        InteractionZone[] InteractionZones = FindObjectsOfType <InteractionZone>();
        InteractionZone   currentClosest   = null;
        float             distToClosest    = Mathf.Infinity;

        foreach (InteractionZone zone in InteractionZones)
        {
            if (!fullInteractionZones.Contains(zone))
            {
                float newDist = (zone.transform.position - transform.position).sqrMagnitude;
                if (newDist < distToClosest)
                {
                    distToClosest  = newDist;
                    currentClosest = zone;
                }
            }
        }

        return(currentClosest.transform);
    }
    private void Update()
    {
        if (_nodeDictionary[_currNode].GetMainText() != null)
        {
            if (_canControlTextDisplay)
            {
                if (_displayText.Contains("INSERTOBJECTONE"))
                {
                    _displayText = _displayText.Replace("INSERTOBJECTONE", UseItemManager.GetItemInUse().name);
                }

                ControlOverallTextDisplay(_displayText);
            }

            _mainLogText = _displayText;
        }

        //print(MyName.GetName());

        if (IsShowing())
        {
            if (Input.GetKeyDown(KeyCode.Mouse0))
            {
                if (_clickCounter < 2)
                {
                    _clickCounter += 1;

                    if (_clickCounter == 1)
                    {
                        if (!SceneManager.GetActiveScene().name.Equals("Prologue"))
                        {
                            string   logText    = GameObject.Find("LogContent").GetComponent <Text>().text;
                            MainText myCurrNode = _nodeDictionary[_currNode];
                            logText += "\n" + myCurrNode.GetCurrCharacter() + ":";
                            logText += "\n" + _mainLogText + "\n";
                            GameObject.Find("LogContent").GetComponent <Text>().text = logText;
                        }
                    }
                }

                if (_clickCounter == 2)
                {
                    MainText currNode = _nodeDictionary[_currNode];

                    if (currNode.HasChoice() == false)
                    {
                        currNode.InvokeOnClickedEvent();

                        if (currNode.goToConsecutiveNodeOnClick)
                        {
                            ChangeNode(int.Parse(currNode.gameObject.transform.GetChild(0).GetComponent <Text>().text) + 1);
                        }
                    }
                }
            }
        }

        MyButton returnButton = null;

        if (GameObject.Find("BackArrow") != null)
        {
            returnButton = GameObject.Find("BackArrow").GetComponent <MyButton>();
        }

        if (returnButton != null)
        {
            if (IsShowing())
            {
                InteractionZone.SetInteractionOn(false);
                if (returnButton != null)
                {
                    returnButton.Hide();
                }
            }
            else
            {
                InteractionZone.SetInteractionOn(true);
                if (returnButton != null && GameObject.Find("Classroom") != null && GameObject.Find("Classroom").GetComponent <SpriteRenderer>().color.a < 1)
                {
                    returnButton.Show();
                }
            }
        }

        if (GameObject.Find("Classroom") != null && GameObject.Find("Classroom").GetComponent <SpriteRenderer>().color.a == 1)
        {
            if (returnButton != null)
            {
                returnButton.Hide();
            }
        }
    }