Пример #1
0
    public void StartAirStrike()
    {
        if (airstrikeStart == null)
        {
            Debug.Log("Airstrike Start == null");
        }
        else
        {
            Debug.Log("Airstrike Start position: " + airstrikeStart.transform.position);
        }

        if (airstrikeEnd == null)
        {
            Debug.Log("Airstrike End == null");
        }
        else
        {
            Debug.Log("Airstrike End position: " + airstrikeEnd.transform.position);
        }

        GameObject obj        = Instantiate(plane, airstrikeStart.transform.position, Quaternion.identity) as GameObject;
        JetFighter jetFighter = obj.GetComponent <JetFighter>();

        jetFighter.StartMoving(airstrikeEnd.transform.position, Vector3.Distance(airstrikeStart.transform.position, airstrikeEnd.transform.position), 7.0f);
        TimerBehavior t = gameObject.AddComponent <TimerBehavior>();

        t.StartTimer(3.5f, FirstStrike);
    }
 void Start()
 {
     _animators  = GetComponentsInChildren <Animator>();
     attackTimer = gameObject.AddComponent <TimerBehavior>();
     Calc_Reach_type();
     Calc_Shase_type();
     Calc_DEath_type();
 }
Пример #3
0
    public void BeginNextWave(float time)
    {
        //first time when we say survivorready this happens +5seconds
        GameManager.Instance.curgamestate = ARZState.WaveBuffer;
        // start next wave in time seconds
        TimerBehavior t = gameObject.AddComponent <TimerBehavior>();

        t.StartTimer(time, WMStartWave);
    }
Пример #4
0
    void Start()
    {
        repeatTimer = gameObject.AddComponent <TimerBehavior>();

        GEtShaderRefs();// m.shader = shader_MobileBumpedSpecular;
        PopulateAvailableShaders();
        _renderersOnThisZombie = GetComponentsInChildren <Renderer>();
        PopulateUniqueMAterials();

        StartCoroutine(AUTOLOOP());
    }
Пример #5
0
 void Start()
 {
     gameState = GameState.LEVELSTART;
     print("Switched to gameState " + gameState);
     levelStartActive = false;
     levelWonActive   = false;
     gameOver         = false;
     currentLevel     = 0;
     timerBehavior    = timer.GetComponent <TimerBehavior>();
     factoryBehavior  = GameObject.Find("Factory").GetComponent <FactoryBehavior>();
     worldManager     = GameObject.Find("GameManager").GetComponent <WorldManager>();
 }
Пример #6
0
    public void FirstStrike()
    {
        Instantiate(explosion, airstrikeStart.transform.position, Quaternion.identity);
        float distance = Vector3.Distance(airstrikeStart.transform.position, airstrikeEnd.transform.position);

        midStrikePosition = Vector3.MoveTowards(airstrikeStart.transform.position, airstrikeEnd.transform.position, distance * 0.5f);
        TimerBehavior t = gameObject.AddComponent <TimerBehavior>();

        t.StartTimer(explosionDelay, SecondStrike);
        t = gameObject.AddComponent <TimerBehavior>();
        t.StartTimer(explosionDelay * 2.0f, FinalStrike);
    }
 public void DOCountDouwn(int argNumber)
 {
     if (argNumber > 0 && argNumber < 11)
     {
         audioManager.PlayEvent("_" + argNumber.ToString());
         CountdownTextBox.text = argNumber.ToString();
     }
     if (argNumber == 1)
     {
         TimerBehavior t = gameObject.AddComponent <TimerBehavior>();
         t.StartTimer(1, HideCountDown);
     }
 }
Пример #8
0
    void Update()
    {
        _timer -= Time.deltaTime;

        if (_timer <= 0f)
        {
            SpawnEnemy();
            _timer = _spawnRate;
        }

        float rate = Mathf.Abs(1 - (TimerBehavior.GetTimer() / 24f));

        _spawnRate = Mathf.Lerp(spawnRateStart, spawnRateEnd, rate);
    }
Пример #9
0
    public void StartMoving(Vector3 targetPosition, float distance, float timeFlying)
    {
        rb           = GetComponent <Rigidbody>();
        audioManager = GetComponent <UAudioManager>();
        TimerBehavior t = gameObject.AddComponent <TimerBehavior>();

        t.StartTimer(timeFlying, DoneFlying);
        transform.LookAt(new Vector3(targetPosition.x, transform.position.y, targetPosition.z));
        transform.position += Vector3.up * height;
        transform.position += transform.forward * -10.0f;
        distance            = distance + 20.0f;
        moveSpeed           = distance / timeFlying;
        audioManager.PlayEvent("_FlyBy");
        startMoving = true;
    }
Пример #10
0
    IEnumerator FadeIn()
    {
        // turn alpha to 0 then show canvas
        focusedGroup.alpha = 0.0f;
        focusedCanvas.SetActive(true);

        while (focusedGroup.alpha < 1.0f)
        {
            focusedGroup.alpha += Time.deltaTime;
            yield return(null);
        }

        TimerBehavior t = gameObject.AddComponent <TimerBehavior>();

        t.StartTimer(GameSettings.Instance.FadeOutStartIn, StartFadeOut);
    }
Пример #11
0
    public void LevelLoaded()
    {
        isLevelLoaded = true;

        // sort spawn points by distance
        SortSpawnPoints();

        if (!isGridBuilt)
        {
            Debug.Log("creating grid");
            CreateGrid();
        }

        Debug.Log("yo, set first person gun !!");
        TimerBehavior t = gameObject.AddComponent <TimerBehavior>();

        t.StartTimer(2.5f, SetGun);
    }
Пример #12
0
    /// <summary>
    /// 设置一个重复调用的多次计时器
    /// </summary>
    /// <param name="action"></param>
    /// <param name="time"></param>
    /// <param name="isIgnoreTimeScale"></param>
    /// <returns></returns>
    public static int SetRepeatTimer(Action action, float time, bool isIgnoreTimeScale = true)
    {
        int tmpTimerID = -1;

        if (null != action && time > 0)
        {
            tmpTimerID = GetTimerID();
            GameObject timerTmpObj = new GameObject();
            GameObject.DontDestroyOnLoad(timerTmpObj);
            timerTmpObj.name = timerName + tmpTimerID.ToString();

            TimerBehavior timerBehavior = timerTmpObj.AddComponent <TimerBehavior>();
            timerFuncDic.Add(tmpTimerID, action);
            timerObjects.Add(tmpTimerID, timerTmpObj);
            timerBehavior.BeginRepeatTimer(RepeatTimerEvent, tmpTimerID, time, isIgnoreTimeScale);
        }
        return(tmpTimerID);
    }
Пример #13
0
    void Awake()
    {
        _myGunBools  = new GunBools(false, false, true);
        _myGunEffect = GetComponent <GunEffects>();

        _myGunAnimate   = GetComponent <GunAnimate>();
        _myMagazineMNGR = GetComponent <MagazineMNGR>();//GUNRELOAD_LINK_RELOAD_METER
        repeatTimer     = gameObject.AddComponent <TimerBehavior>();
        if (gunType == GunType.UZI)
        {
            repeatTime = 0.05f;
        }
        else
        {
            repeatTime = 0f;
        }
        InitBarelTrans();
    }
Пример #14
0
    public void GM_Handle_WaveCompleteByPoppingNUMplusplus()
    {
        _scoreManager.Increment_WavesPlayedCNT();
        // reset wave points
        _scoreManager.Reset_WavePoints();

//could add accuracy bonus here for each wave, if we pas points to this method

        // activate canvas spash
        _gameCanvas.WaveCompleteWeaponUpgare();

        // load next wave and launch in 10 seconds
        _waveManager.WaveCompleted_soPopANewOne();

        // activate next wave splash in 6 seconds
        TimerBehavior t = gameObject.AddComponent <TimerBehavior>();

        t.StartTimer(GameSettings.Instance.StartRomanIn, WaveStartedGraphics);
    }
Пример #15
0
    public void RoomLoaded()
    {
        isRoomLoaded = true;
        if (_waveManager == null)
        {
            _waveManager = FindObjectOfType <WaveManager>();
        }

        if (_waveManager.isWaveLoaded)
        {
            WorldAnchorStore.GetAsync(AnchorStoreReady);
        }
        else
        {
            // if wave is not loaded check back in a half second
            TimerBehavior t = new TimerBehavior();
            t.StartTimer(0.5f, RoomLoaded);
        }
    }
Пример #16
0
    public void ActivateDevRoom()
    {
        Debug.Log("Roomloader loaded devroom");
        isRoomLoaded = true;
        if (_waveManager == null)
        {
            _waveManager = FindObjectOfType <WaveManager>();
        }

        if (_waveManager.isWaveLoaded)
        {
            LoadObjectsFromDevRoom();
        }
        else
        {
            // if wave is not loaded check back in a half second
            TimerBehavior t = new TimerBehavior();
            t.StartTimer(0.5f, RoomLoaded);
        }
    }
Пример #17
0
    public void KeepPlaying()
    {
        GameIsNotOver_IcanmakeZombies = true;
        currentWave.GetComponent <WaveStandard>().ResetSpawnStates();
        isWaveLoaded = false;
        Destroy(currentWave);

        StemKitMNGR.CALL_ResetGunAndMeter();
        if (!GameSettings.Instance.IsGameLong)
        {
            currentWave  = Instantiate(ShortWaves[waveNum]);
            wave         = currentWave.GetComponent <IWave>();
            WS           = GetCurrWave();
            isWaveLoaded = true;

            TimerBehavior t = gameObject.AddComponent <TimerBehavior>();
            t.StartTimer(GameSettings.Instance.StartResetWaveIn, ResetWave);


            t = gameObject.AddComponent <TimerBehavior>();
            t.StartTimer(GameSettings.Instance.StartWaveAgain, WMStartWave);
        }
        else
        {
            currentWave  = Instantiate(waves[waveNum]);
            wave         = currentWave.GetComponent <IWave>();
            WS           = GetCurrWave();
            isWaveLoaded = true;

            TimerBehavior t = gameObject.AddComponent <TimerBehavior>();
            t.StartTimer(GameSettings.Instance.StartResetWaveIn, ResetWave);


            t = gameObject.AddComponent <TimerBehavior>();
            t.StartTimer(GameSettings.Instance.StartWaveAgain, WMStartWave);
        }
    }
Пример #18
0
 void Awake()
 {
     _instance = this;
 }
Пример #19
0
 // Use this for initialization
 void Start()
 {
     timer_text  = GetComponentInChildren <TimerBehavior>();
     deaths_text = GetComponentInChildren <DeathTextBehavior>();
 }
Пример #20
0
 void Start()
 {
     gameState = GameState.LEVELSTART;
     print("Switched to gameState " + gameState);
     levelStartActive = false;
     levelWonActive = false;
     gameOver = false;
     currentLevel = 0;
     timerBehavior = timer.GetComponent<TimerBehavior>();
     factoryBehavior = GameObject.Find("Factory").GetComponent<FactoryBehavior>();
     worldManager = GameObject.Find ("GameManager").GetComponent<WorldManager>();
 }
Пример #21
0
    void LoadObjects()
    {
        if (_waveManager.GetWave() == null)
        {
            TimerBehavior t = gameObject.AddComponent <TimerBehavior>();
            t.StartTimer(0.5f, LoadObjects);
            return;
        }

        if (!IsInDevRoom())
        {
            // gather all stored anchors
            string[] ids = anchorStore.GetAllIds();
            for (int index = 0; index < ids.Length; index++)
            {
                if (ids[index] == AnchorName_StemBase)
                {
                    if (curgamemode != ARZGameModes.GameNoStem)
                    {
                        reticle.gameObject.SetActive(false);



                        // if anchor is stem system
                        // instantiate stem system prefab it should have been set to left or right on start
                        GameObject obj = Instantiate(stemSystemKit) as GameObject;
                        anchorStore.Load(ids[index], obj);

                        // delete anchor component
                        WorldAnchor attachedAnchor = obj.GetComponent <WorldAnchor>();
                        if (attachedAnchor != null)
                        {
                            DestroyImmediate(attachedAnchor);
                        }

                        _stmKitMngr = obj.GetComponent <StemKitMNGR>();
                    }
                }
                else if (ids[index] == AnchorName_ConsoleObject)
                {
                    // if anchor is console object
                    // instantiate console prefab
                    GameObject obj = Instantiate(consoleObject) as GameObject;
                    anchorStore.Load(ids[index], obj);

                    // delete anchor component
                    WorldAnchor attachedAnchor = obj.GetComponent <WorldAnchor>();
                    if (attachedAnchor != null)
                    {
                        DestroyImmediate(attachedAnchor);
                    }
                }
                else if (ids[index] == AnchorName_ScoreBoard)
                {
                    // if anchor is scoreboard
                    // instantiate scoreboard from anchor data
                    GameObject obj = Instantiate(scoreboard) as GameObject;
                    anchorStore.Load(ids[index], obj);

                    // delete anchor component
                    WorldAnchor attachedAnchor = obj.GetComponent <WorldAnchor>();
                    if (attachedAnchor != null)
                    {
                        DestroyImmediate(attachedAnchor);
                    }
                }
                //--------------------------------------------------------------------
                else if (ids[index] == AnchorName_Target)
                {
                    // if anchor is scoreboard
                    // instantiate scoreboard from anchor data
                    GameObject obj = Instantiate(target) as GameObject;
                    anchorStore.Load(ids[index], obj);

                    // delete anchor component
                    WorldAnchor attachedAnchor = obj.GetComponent <WorldAnchor>();
                    if (attachedAnchor != null)
                    {
                        DestroyImmediate(attachedAnchor);
                    }

                    TargCTRL = obj.GetComponent <TargetControle>();
                }
                //--------------------------------------------------------------------
                else if (ids[index] == AnchorName_StartButton)
                {
                    GameObject obj = Instantiate(startButton) as GameObject;
                    anchorStore.Load(ids[index], obj);

                    // delete anchor component
                    WorldAnchor attachedAnchor = obj.GetComponent <WorldAnchor>();
                    if (attachedAnchor != null)
                    {
                        DestroyImmediate(attachedAnchor);
                    }

                    StartCTRL = obj.GetComponent <StartButtonControle>();
                }
                //-------------------------------------------------------------------- AnchorName_StartButton



                else if (ids[index] == AnchorName_metalBarrel)
                {
                    // if anchor is weapons rack
                    // instantiate weapons rack from anchor data
                    GameObject obj = Instantiate(metalBarrel) as GameObject;
                    anchorStore.Load(ids[index], obj);

                    // delete anchor component
                    WorldAnchor attachedAnchor = obj.GetComponent <WorldAnchor>();
                    if (attachedAnchor != null)
                    {
                        DestroyImmediate(attachedAnchor);
                    }

                    //  obj.transform.Rotate(Vector3.up, 180.0f); or not
                    // rack = obj.GetComponent<WeaponRack>();
                }


                else if (ids[index] == AnchorName_roomModel)
                {
                    // if anchor is weapons rack
                    // instantiate weapons rack from anchor data
                    GameObject obj = Instantiate(roomModel) as GameObject;
                    anchorStore.Load(ids[index], obj);

                    // delete anchor component
                    WorldAnchor attachedAnchor = obj.GetComponent <WorldAnchor>();
                    if (attachedAnchor != null)
                    {
                        DestroyImmediate(attachedAnchor);
                    }

                    //  obj.transform.Rotate(Vector3.up, 180.0f); or not
                    // rack = obj.GetComponent<WeaponRack>();
                }

                else if (ids[index].Contains(AnchorName_AmmoBoxInfinite))
                {
                    // if anchor is infinite ammo box
                    // instantiate infinite ammo box from anchor data
                    GameObject obj = Instantiate(infiniteAmmoBox) as GameObject;
                    anchorStore.Load(ids[index], obj);

                    // delete anchor component
                    WorldAnchor attachedAnchor = obj.GetComponent <WorldAnchor>();
                    if (attachedAnchor != null)
                    {
                        DestroyImmediate(attachedAnchor);
                    }
                }
                else if (ids[index] == AnchorName_PathFinder)
                {
                    // if anchor is pathfinder
                    // instantiate pathfinder from anchor data
                    GameObject obj = Instantiate(gridMap) as GameObject;
                    anchorStore.Load(ids[index], obj);

                    // delete anchor component
                    WorldAnchor attachedAnchor = obj.GetComponent <WorldAnchor>();
                    if (attachedAnchor != null)
                    {
                        DestroyImmediate(attachedAnchor);
                    }


                    Locate_Lines_ANC_Pivot(obj);
                }



                else if (ids[index].Contains(AnchorName_SpawnPoint))
                {
                    // if anchor is a spawn point
                    // instantiate spawn point from anchor data
                    GameObject obj = Instantiate(spawnPoint) as GameObject;
                    anchorStore.Load(ids[index], obj);

                    // add spawn point to collection
                    spawnPoints.Add(obj);

                    // delete anchor component
                    WorldAnchor attachedAnchor = obj.GetComponent <WorldAnchor>();
                    if (attachedAnchor != null)
                    {
                        DestroyImmediate(attachedAnchor);
                    }
                }
                else if (ids[index].Contains(AnchorName_HotSpot))
                {
                    // if anchor is a hotspot
                    // instantiate hotspot from anchor data
                    GameObject obj = Instantiate(hotspot) as GameObject;
                    anchorStore.Load(ids[index], obj);

                    // add spawn point to collection
                    hotspots.Add(obj);

                    // delete anchor component
                    WorldAnchor attachedAnchor = obj.GetComponent <WorldAnchor>();
                    if (attachedAnchor != null)
                    {
                        DestroyImmediate(attachedAnchor);
                    }
                }

                else if (ids[index].Contains(AnchorName_MistEmitter))
                {
                    // if anchor is mist
                    // instantiate mist from anchor data
                    GameObject obj = Instantiate(mist) as GameObject;
                    anchorStore.Load(ids[index], obj);

                    mists.Add(obj);

                    // delete anchor component
                    WorldAnchor attachedAnchor = obj.GetComponent <WorldAnchor>();
                    if (attachedAnchor != null)
                    {
                        DestroyImmediate(attachedAnchor);
                    }
                }
                else if (ids[index].Contains(AnchorName_MistEnd))
                {
                    //MistMover MistMoverScript = FindObjectOfType<MistMover>();

                    //// if none exist then instantiate one
                    //if (MistMoverScript == null)
                    //{
                    //    GameObject obj = Instantiate(mist) as GameObject;
                    //    MistMoverScript = obj.GetComponent<MistMover>();
                    //}

                    // instantiate placeholder at world anchor position
                    _placeHolderMistTarget = Instantiate(placeholder) as GameObject;
                    anchorStore.Load(ids[index], _placeHolderMistTarget);

                    // delete anchor component
                    WorldAnchor attachedAnchor = _placeHolderMistTarget.GetComponent <WorldAnchor>();
                    if (attachedAnchor != null)
                    {
                        DestroyImmediate(attachedAnchor);
                    }

                    // add placeholder to airstrike object as air strike end
                    //MistMoverScript.SetMistEnd(placeholderObject);
                }
            }
        }

        if (_placeHolderMistTarget == null)
        {
            DebugConsole.print("mist target is NULL!");
        }

        LevelLoaded();
    }