Beispiel #1
0
    void Start()
    {
        if (ExerciseSettings.durationIsDistance == false)
        {
            if ((((ExerciseSettings.time / 60) * ExerciseSettings.targetSpeed * 1000) % 10) >= 5)
            {
                trackLength = ((ExerciseSettings.time / 60) * ExerciseSettings.targetSpeed * 1000) + (10 - (((ExerciseSettings.time / 60) * ExerciseSettings.targetSpeed * 1000) % 10));
            }
            else
            {
                trackLength = ((ExerciseSettings.time / 60) * ExerciseSettings.targetSpeed * 1000) - (((ExerciseSettings.time / 60) * ExerciseSettings.targetSpeed * 1000) % 10);
            }

            targetPaceIncrement = ((checkPointDistance / (ExerciseSettings.targetSpeed * 1000)) * 3600);
            uiOverlay           = GameObject.Find("GameBike").GetComponent <UIOverlay> ();
        }
    }
Beispiel #2
0
    public void CloseDialog()
    {
        BaseDialog dialog  = this.getDialogCurrent();
        UIOverlay  overlay = FindObjectOfType <UIOverlay>();

        if (overlay != null)
        {
            this.overlay.OnHide();
        }
        if (dialog != null)
        {
            dialog.OnHide();
            if (this.dialogs.Contains(dialog))
            {
                this.dialogs.Remove(dialog);
            }
        }
    }
Beispiel #3
0
    void Awake()
    {
        instance = this;

        uiHUD           = gameObject.GetComponent <UIHUD>();
        uiOverlay       = gameObject.GetComponent <UIOverlay>();
        uiAbility       = gameObject.GetComponent <UIAbilityButtons>();
        uiPerkMenu      = gameObject.GetComponent <UIPerkMenu>();
        uiGameOver      = gameObject.GetComponent <UIGameOver>();
        uiUnitPlacement = gameObject.GetComponent <UIUnitPlacement>();

        //uiHUD.enabled=false;
        uiOverlay.enabled = false;
        //uiAbility.enabled=false;
        uiGameOver.enabled      = false;
        uiUnitPlacement.enabled = false;

        colorH = new Color(1f, .6f, 0f, 1f);
        colorN = new Color(1f, .85f, .75f, 1f);
        texBar = Resources.Load("Textures/Bar", typeof(Texture)) as Texture;
    }
Beispiel #4
0
 public void ShowOverlay(UIOverlay.TYPE type)
 {
     if (overlay != null)
     {
         overlay.transform.SetParent(this.scene.panelPopup);
         overlay.transform.localScale    = Vector3.one;
         overlay.transform.localPosition = Vector3.zero;
         RectTransform rect = (RectTransform)overlay.transform;
         rect.sizeDelta = Vector3.zero;
         overlay.OnShow(type);
     }
     else
     {
         this.overlay = ((GameObject)Instantiate(Resources.Load("Dialog/UIOverlay"))).GetComponent <UIOverlay>();
         this.overlay.transform.SetParent(this.scene.panelPopup);
         this.overlay.transform.localScale    = Vector3.one;
         this.overlay.transform.localPosition = Vector3.zero;
         RectTransform rect = (RectTransform)this.overlay.transform;
         rect.sizeDelta = Vector3.zero;
         this.overlay.OnShow(type);
     }
 }
Beispiel #5
0
	void Awake(){
		
		instance=this;
		
		uiHUD=gameObject.GetComponent<UIHUD>();
		uiOverlay=gameObject.GetComponent<UIOverlay>();
		uiAbility=gameObject.GetComponent<UIAbilityButtons>();
		uiPerkMenu=gameObject.GetComponent<UIPerkMenu>();
		uiGameOver=gameObject.GetComponent<UIGameOver>();
		uiUnitPlacement=gameObject.GetComponent<UIUnitPlacement>();
		
		//uiHUD.enabled=false;
		uiOverlay.enabled=false;
		//uiAbility.enabled=false;
		uiGameOver.enabled=false;
		uiUnitPlacement.enabled=false;
		
		colorH=new Color(1f, .6f, 0f, 1f);
		colorN=new Color(1f, .85f, .75f, 1f);
		texBar=Resources.Load("Textures/Bar", typeof(Texture)) as Texture;
		
		
	}
    public void onDeath()
    {
        if (_thisPlayerTeam == Team.Doctors)
        {
            SoundManager._inst.playSoundOnceAt(SoundEnum.DoctorDie, transform.position);
        }
        else
        {
            SoundManager._inst.playSoundOnceAt(SoundEnum.PatientDie, transform.position);
        }

        if (!_photonView.IsMine)
        {
            return;
        }
        _animator.SetBool("Died", true);
        deathCount++;
        SoundManager._inst.playSoundOnce(SoundEnum.WhileWaitForRespawn);
        cStatus      = playerStatus.dead;
        respawnTimer = respawnTime;
        UIOverlay.show(EnumsData.UIOverlay.dead);
        InGameManager._inst.setDeadFollowNexT();
        UIInGameCanvas._inst.setLocalPlayerStats(killsOnPlayersCount, killsOnBotCount, deathCount);
    }
Beispiel #7
0
    private void Update()
    {
        if (currentHealth > 0)
        {
            gameObject.GetComponent <SpriteRenderer>().flipX = Player.transform.position.x > transform.position.x ? true : false;
            if (UIOverlay != null)
            {
                UIOverlay.transform.position = //-CameraFollow.offset +
                                               Camera.main.WorldToScreenPoint(transform.parent.position + transform.parent.up);
                UIOverlay.GetComponent <Text>().text = "State = " + state.ToString() + "\nHealth = " + currentHealth;
            }
            if (transform.parent.rotation != Quaternion.identity) //cleanups
            {
                transform.parent.rotation = Quaternion.identity;
            }
            if (transform.position != transform.parent.position)
            {
                transform.position = transform.parent.position;
            }
            if (name.Contains("Sorcerer"))
            {
                an.SetBool("Move", true);
            }
            if (an.GetCurrentAnimatorClipInfo(0)[0].clip.name.Contains("Idle") && !isIdle)
            {
                state = determineState();
                switch (state)
                {
                case EnemyState.Attack:
                    an.SetBool("Move", false);
                    an.SetTrigger("Attack");
                    break;

                case EnemyState.Chase:
                    an.SetBool("Move", true);
                    transform.parent.GetComponent <NavMeshAgent>().SetDestination(Player.transform.position);
                    break;

                case EnemyState.Flee:
                    an.SetBool("Move", true);
                    transform.parent.GetComponent <NavMeshAgent>().SetDestination((transform.position - Player.transform.position).normalized * Random.Range(1.2f, 1.5f));
                    break;

                case EnemyState.Return:
                    an.SetBool("Move", true);
                    transform.parent.GetComponent <NavMeshAgent>().SetDestination(transform.parent.parent.position);
                    break;

                case EnemyState.Wander:
                    an.SetBool("Move", true);
                    newDest(0);
                    break;

                default:
                    an.SetBool("Move", false);
                    StartCoroutine(Idle(Random.Range(3, 5)));
                    break;
                }
            }
            else
            {
                if (transform.parent.GetComponent <NavMeshAgent>().path.status == NavMeshPathStatus.PathComplete && state != EnemyState.Attack && state != EnemyState.Idle)
                {
                    an.SetBool("Move", false);
                }
            }
        }
    }
    /// <summary>
    /// The standard Unity Start method.
    /// </summary>
    void Start()
    {
        // Set the initial position and rotation; set the character controller.
        initialPosition = transform.position;
        initialRotation = transform.rotation;
        this.characterController = this.GetComponent<CharacterController>();

        // Reset position (altitude) and heading.
        this.ResetPositionAndHeadingToTransform();

        // Get a new BikeData object.
        bikeData = new BikeData();

        #if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN

        // Try to start Ant.
        try
        {
            this.antStick = new AntStick();
            this.antStickBridge = new AntStickBridge(antStick, bikeData);
            this.antStick.Start();
        }
        catch (Exception ex)
        {
            Debug.LogWarningFormat("[BikeController] Exception while loading Ant.\n{0}", ex.Message);
        }

        // Try to start the XSens Gyro.
        try
        {
            this.xsensGyro = new XSensGyro();
            this.xsensGyroBridge = new XSensGyroBridge(xsensGyro, this);
            this.xsensGyro.Start();
            // We have to wait after starting the gyro to zero it.
            StartCoroutine(WaitThenZeroXSensGyro());
        }
        catch (Exception ex)
        {
            Debug.LogWarningFormat("[BikeController] Exception while loading XSens Gyro. The DLL is probably missing.\n{0}", ex.Message);
        }

        #else

        Debug.LogWarning("[BikeController] ANT and XSens are not available on non-Windows platforms.");

        #endif

        // Initialize and attach all the supplemental components needed by Bike Controller.

        UIOverlay.SetBikeController(this);
        this.uiOverlay = gameObject.AddComponent<UIOverlay>();

        UIDebugOverlay.SetBikeController(this);
        this.uiDebugOverlay = gameObject.AddComponent<UIDebugOverlay>();

        this.bikePhysics = new BikePhysics(this);
        this.bikeSteering = new BikeSteering(this, this.steeringCurve);

        // Disable collisions between player character and the terrain.
        CharacterController characterController = this.GetComponent<CharacterController>();
        TerrainCollider terrainCollider = CollisionDisabler.GetTerrainColliderForActiveTerrain();
        (new CollisionDisabler(characterController, terrainCollider)).Start();

        // Start the timer.
        this._refTime = DateTime.Now;
        this._timerStarted = true;
    }
Beispiel #9
0
 protected virtual void Start()
 {
     uiOverlay       = GameObject.FindGameObjectWithTag("UI").GetComponent <UIOverlay>();
     SelectableLayer = LayerMask.NameToLayer("Selectable");
     SelectedLayer   = LayerMask.NameToLayer("Selected");
 }