Example #1
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);
    }
Example #2
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);
    }
    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);
    }
 void DamageThePlayer()
 {
     if (GameManager.Instance != null)
     {
         GameManager.Instance.AttackPlayer();
         attackTimer.StartTimer(attackSpeed, Attack, false);
     }
     else
     {
         Debug.Log("no Gm can't attack player");
     }
 }
 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);
     }
 }
    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);
        }
    }
    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;
    }
Example #8
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);
    }
    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);
    }
    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);
    }
    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);
        }
    }
    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);
        }
    }
Example #13
0
 void LevelStart()
 {
     if (!levelStartActive)
     {
         audio.Stop();
         audio.Play();
         startSign.gameObject.SetActive(true);
         timerBehavior.SetTimer(levelTime[currentLevel]);
         factoryBehavior.LevelSetUp(levelGoals[currentLevel]);
         levelStartActive = true;
         return;
     }
     if (Input.GetMouseButtonUp(LMB))
     {
         timerBehavior.StartTimer();
         gameState = GameState.INPLAY;
         print("Switched to gameState " + gameState);
         startSign.gameObject.SetActive(false);
         levelStartActive = false;
     }
 }
Example #14
0
    //_myGunBools.CanAcceptNewClip = true;
    public void GUN_FIRE()
    {
        //****************************************************************************************************************************************
        //gunhelper.DrawStatic(barrelTran.transform.position, barrelTran.transform.position + (barrelTran.transform.forward * -5));
        //****************************************************************************************************************************************

        Quaternion thenewrot = DoSpread(stopSpreading);

        // gunhelper.DrawStatic(barrelTran.transform.position, thenewrot  * Vector3.one *5);

        //****************************************************************************************************************************************
        //gunhelper.DrawStatic(barrelTran.transform.position, barrelTran.transform.position + (thenewrot*(barrelTran.transform.forward * 5)  ));
        //****************************************************************************************************************************************
        if (_myGunBools.ThisGunIsReloading)
        {
            Debug.Log("no shot I b reloading "); return;
        }

        if (!_myMagazineMNGR.IsMagPlaced())
        {
            Debug.Log("no shot no mag in "); return;
        }

        if (!_myMagazineMNGR.IsThereBulletsInCurmag())
        {
            // Debug.Log("play dry shot  caling cell0");
            _myGunEffect.AUDIO_Dry();
            if (GameSettings.Instance.ReloadDifficulty != ARZReloadLevel.EASY)
            {
                StemKitMNGR.CALL_Start_UIcell(0);

                _myGunBools.ThisGunIsReloading = true;
                _myGunBools.CAnManuallyDropMag = true;
            }
            return;
        }


        {
            // repeat fire if gun type is uzi
            if (gunType == GunType.UZI)
            {
                _myGunAnimate.PlayFastest();
                stopSpreading = false;
                repeatTimer.StartTimer(repeatTime, GUN_FIRE, false);
            }
            else
            {
                _myGunAnimate.PlayFast();
            }

            if (!_myMagazineMNGR.IsMagPlaced())
            {
                Debug.Log("no mag");
                GUN_STOP_FIRE();//FOR SAFE MEASURE
                return;
            }
            if (_myMagazineMNGR.CanDecrementCurMagBulletCount())
            {
                //_myGunBools.BHazBullets = true;

                Instantiate(_myMagazineMNGR.GetChamberedBullet(), barrelTran.position, thenewrot);// barrelTran.rotation);
                _myGunAnimate.Gunimate_FIRE();
                GunFlash_FIRE();
            }
        }
    }
    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();
    }