Beispiel #1
0
    // Use this for initialization
    void Start()
    {
        TotalCoinsText.text = PlayerPrefs.GetInt("TotalCoins").ToString();

        cameraScroll = cam.GetComponent <CameraScroll>();
        pauseLevel   = UIManager.GetComponent <PauseLevel>();
        timerScript  = UIManager.GetComponent <TimerScript>();
        //advertismentScript = UIManager.GetComponent<AdvertisementScript>();
        muteAudio            = UIManager.GetComponent <MuteAudio>();
        levelCharacteristics = UIManager.GetComponent <LevelCharacteristics>();

        if (levelCharacteristics.isGravitySwitch)
        {
            jumpDirection = Vector2.left;
            levelCharacteristics.GravitySwitch();
        }



        coinArray      = GameObject.FindGameObjectsWithTag("Coin");
        coinListLength = coinArray.Length;
        for (int x = 0; x < coinListLength; x++)
        {
            coinList.Add(coinArray[x]);
        }



        playerPosition = player.transform.position; camPosition = cam.transform.position;
        music.Pause();
    }
Beispiel #2
0
    // Use this for initialization
    void Start()
    {
        pauseLevel   = UIManager.GetComponent <PauseLevel>();
        playerScript = player.GetComponent <PlayerScript>();
        music        = player.GetComponent <AudioSource>();

        Time.timeScale = 2f;
    }
    void OnTriggerEnter(Collider other)
    {
        Debug.Log(" on enter " + other.tag);

        if (other.tag == "Pauser")
        {
            Debug.Log(" on pauser enter ");
            PauseLevel p = other.GetComponent <PauseLevel> ();
            p.OnEnter();
        }

        if (other.tag == "Enemy")
        {
            //enable it

            Debug.Log("enable time");
            MonoBehaviour[] scripts = other.GetComponentsInChildren <MonoBehaviour>();
            foreach (MonoBehaviour item in scripts)
            {
                item.enabled = true;
            }
        }
    }
Beispiel #4
0
 // Use this for initialization
 void Start()
 {
     cameraScroll = cam.GetComponent <CameraScroll>();
     pauseLevel   = UIManager.GetComponent <PauseLevel>();
 }
Beispiel #5
0
    void Update()
    {
        PursueCount = _pursuingAgent.Count;
        if (GameState.Instance.PauseLevel != PauseLevel.Unpaused && _lastPauseLevel == PauseLevel.Unpaused)
        {
            _unpausedVelocity = GetComponent <Rigidbody>().velocity;
            GetComponent <Rigidbody>().velocity = Vector3.zero;
            return;
        }
        else if (GameState.Instance.PauseLevel == PauseLevel.Unpaused && _lastPauseLevel != PauseLevel.Unpaused)
        {
            GetComponent <Rigidbody>().velocity = _unpausedVelocity;
        }
        _lastPauseLevel   = GameState.Instance.PauseLevel;
        AnyLigasePursuing = _pursuingAgent.Count != 0;
        if (AnyLigasePursuing)
        {
            //PursuingUbiquitin = _pursuingAgent.gameObject;
        }
        if (!_loaded && Time.time - _lastLoadTime > _reloadTime)
        {
            LoadUbiquitinParticle();
            _lastLoadTime = Time.time;
        }
        if (_pursuingAgent.Contains(this))
        {
            pursue.Weight = 1;
            wander.Weight = 0;

            Vector3 velocity          = pursue.GetComponent <Rigidbody>().velocity.normalized;
            Vector3 directionToTarget = (pursue.GetTarget().transform.position - transform.position).normalized;

            if (Vector3.Dot(velocity, directionToTarget) < 0 && pursue.GetComponent <Rigidbody>().velocity.magnitude > _pursuitSpeed * 0.5f)
            {
                _pursuingAgent.Remove(this);
            }

            /*
             * if (!ubiquitinTriggerScript.IsShipDetected())
             * {
             *  maxSpeed = _wanderSpeed;
             *  maxAcceleration = _wanderAcceleration;
             *  _isPursuing = false;
             *  _pursuingAgent = null;
             * }*/
        }
        else
        {
            pursue.Weight = 0;
            wander.Weight = 1;
        }

        ResolveCurrentBehavior();
        if (!_substrate.CanBeUbiquinated)
        {
            MaxSpeed        = _wanderSpeed;
            MaxAcceleration = _wanderAcceleration;
            _isPursuing     = false;
            _pursuingAgent.Clear();
        }
    }
Beispiel #6
0
 void Instance_OnPauseLevelChanged(PauseLevel pauseLevel)
 {
     _controlsEnabled = pauseLevel == PauseLevel.Unpaused;
 }