Exemple #1
0
        public void LevelUp(int level, float radius, float respawnInterval)
        {
            Instance.gameObject.SetActive(true);

            Level = level;

            RespawnTimer.ActivationInterval = respawnInterval;
            RespawnTimer.Reset();

            Radius = radius;

            if (level > 1)
            {
                foreach (var sentinel in Sentinels)
                {
                    if (sentinel.isActiveAndEnabled)
                    {
                        //float newDistanceRatio = sentinel.CurrentRadius / Radius;
                        //sentinel.RadiusRatio = newDistanceRatio;
                        FireSentinelForward(sentinel);
                    }

                    sentinel.MaxRadius = Radius;
                }
            }
            else
            {
                foreach (var sentinel in Sentinels)
                {
                    sentinel.MaxRadius = Radius;
                }
            }

            ActivateAllSentinels();
        }
Exemple #2
0
    private void RespawnTimer_OnCompleted(IClockTimer sender, TimeEventArgs e)
    {
        Debug.Log("Respawn Timer completed");
        // Reset the clock
        RespawnTimer.StopClockTimer();

        // If the player is completely dead, dont respawn
        if (!Lives.HasLives)
        {
            return;
        }

        // Otherwise, Reset stats and Respawn the Player
        m_rigidbody2D.velocity = Vector3.zero;
        var spawnPoint = Game.Level.GetRandomSpawn();

        transform.position = spawnPoint.transform.position;

        Stamina.SetMaxStamina();

        // Enable the players scripts
        //var colliderPlayerScripts = new List<MonoBehaviour>();
        //colliderPlayerScripts.AddRange(gameObject.GetComponents<MonoBehaviour>());
        //colliderPlayerScripts.AddRange(gameObject.GetComponentsInChildren<MonoBehaviour>());
        //foreach (var script in colliderPlayerScripts)
        //{
        //    script.enabled = true;
        //}

        // Show the Player
        Lives.IsAlive = true;
    }
 void Start()
 {
     player = GameObject.FindWithTag("Player");
     player_cam = player.transform.Find("Player_Cam").gameObject;
     respawn = player.GetComponent<RespawnTimer>();
     wheelTurn = transform.Find("Wheel Container").GetComponent<WheelTurn>();
     handle1 = transform.Find("Handle1").gameObject;
     handle2 = transform.Find("Handle2").gameObject;
 }
Exemple #4
0
 public override void SetNewStageParameters()
 {
     MoveToStartPosition();
     Dx        = 0;
     Dy        = 0;
     Direction = Direction.Up;
     Immortal  = false;
     MoveTimer.Stop();
     RespawnTimer.Start();
 }
Exemple #5
0
 protected override void OnExplosionTimerTick(object sender, EventArgs e)
 {
     base.OnExplosionTimerTick(sender, e);
     if (ExplosionFrame == 0 && Lives >= 0)
     {
         Stars = 0;
         MoveToStartPosition();
         RespawnTimer.Start();
         Direction = Direction.Up;
     }
 }
Exemple #6
0
        protected override void OnFrameRun(float deltaTime, float realDeltaTime)
        {
            //if (Level == 0)
            //    return;

            Rotation.AddAngle(deltaTime * AngularVelocity);

            if (RespawnTimer.UpdateActivates(deltaTime))
            {
                ActivateRandomSentinel();
            }
        }
Exemple #7
0
 public override void SetNewStageParameters()
 {
     MoveToStartPosition();
     Direction = Direction.Down;
     Lives     = 0;
     Stars     = GameRandom.RandNumber(0, 3);
     Immortal  = false;
     Amphibian = false;
     Gun       = false;
     MoveTimer.Stop();
     RespawnTimer.Start();
 }
    void Awake()
    {
        timer = GameObject.FindWithTag("Player").GetComponent<RespawnTimer>();
        myRenderer = renderer;
        if(myRenderer == null) enabled = false;
        size = new Vector2 (1.0f / columns ,1.0f / rows);
        myRenderer.material.SetTextureScale ("_MainTex", size);

        fadeLevel = myRenderer.material.color;
        fadeLevel.a = 0;
        myRenderer.material.color = fadeLevel;
    }
            public void Respawn(int seconds)
            {                   // countdown
                RespawnSeconds = seconds;

                if (m_RespawnTimer != null && m_RespawnTimer.Running)
                {
                    m_RespawnTimer.Stop();
                    m_RespawnTimer.Eat = true;
                }

                m_RespawnTimer = new RespawnTimer(TimeSpan.FromSeconds(5), this, TimeSpan.FromSeconds(1));
                m_RespawnTimer.Start();
            }
Exemple #10
0
    void Start()
    {
        Cursor.visible              = !Cursor.visible;
        Cursor.lockState            = CursorLockMode.Locked;
        QualitySettings.vSyncCount  = 0; // VSync must be disabled
        Application.targetFrameRate = 30;
        players      = new Dictionary <int, GameObject>();
        hpTxt        = GameObject.Find("hp").GetComponent <Text>();
        dmTxt        = GameObject.Find("dm").GetComponent <Text>();
        youTxt       = GameObject.Find("youTxt").GetComponent <Text>();
        maxTxt       = GameObject.Find("maxTxt").GetComponent <Text>();
        timeTxt      = GameObject.Find("timeTxt").GetComponent <Text>();
        recordTxt    = GameObject.Find("recordTxt").GetComponent <Text>();
        hpFill       = GameObject.Find("hpfill").GetComponent <Image>();
        keyMenu      = GameObject.Find("menuchiavi").GetComponent <KeyMenu>();
        quitmenu     = GameObject.Find("quitmenu").transform;
        UI           = GameObject.Find("UI");
        respawnTimer = GameObject.Find("esito").GetComponent <RespawnTimer>();
        materieShow  = GameObject.Find("materieshow").GetComponent <MaterieShow>();
        cam          = GameObject.Find("Camera").GetComponent <CameraController>();
        overlayItems = new List <OverlayControl>((OverlayControl[])GameObject.FindObjectsOfType(typeof(OverlayControl)));
        nm           = GameObject.Find("NetworkManager").GetComponent <NetworkManager>();
        maxTxt.text  = nm.getConfiguration().kills.ToString();

        if (nm.getConfiguration().time2newmatch > 0)
        {
            timeLeft = 0;
            respawnTimer.Start(nm.getConfiguration().time2newmatch, "Partita terminata!");
        }
        else
        {
            timeLeft = nm.getConfiguration().timeLeft;
        }

        calculateProperties();

        nm.nc.RegisterHandler(100, MatchEnded);
        nm.nc.RegisterHandler(101, MatchStarted);
        nm.nc.RegisterHandler(778, OnWelcome);
        nm.nc.RegisterHandler(811, OnEnemyConnect);

        ServerAuth serverAuth = new ServerAuth();

        serverAuth.username = username;
        serverAuth.media    = baseDamage;
        Debug.Log("Connected: " + nm.nc.isConnected);
        nm.nc.Send(777, serverAuth);
        regenerateMaterie();
    }
            public void Deserialize(GenericReader reader)
            {
                int version = reader.ReadInt();

                switch (version)
                {
                case 3:
                {
                    m_PreGameMap = reader.ReadMap();
                    goto case 2;
                }

                case 2:
                {
                    m_Mobile = reader.ReadMobile();
                    m_ctfc   = (CTFControl)reader.ReadItem();
                    goto case 1;
                }

                case 1:
                {
                    // read the player's return location
                    m_PreGameLocation = reader.ReadPoint3D();

                    // read the int data
                    int count = reader.ReadInt();
                    for (int ix = 0; ix < count; ix++)
                    {
                        m_IntData[ix] = reader.ReadInt();
                    }
                    goto case 0;
                }

                case 0:
                {
                    goto default;
                }

                default:
                    break;
                }

                // do we need a res?
                if (RespawnSeconds > 0 && m_Mobile != null && m_Mobile.Deleted == false && !m_Mobile.Alive)
                {                       // use the remaining seconds - have a 10 second delay to accomodate for shard up
                    m_RespawnTimer = new RespawnTimer(TimeSpan.FromSeconds(10), this, TimeSpan.FromSeconds(1));
                    m_RespawnTimer.Start();
                }
            }
Exemple #12
0
        protected virtual void OnRespawnTimerTick(object sender, EventArgs e)
        {
            RespawnFrame += 64;
            if (RespawnFrame == 896)
            {
                RespawnFrame = 0;
                RespawnTimer.Stop();

                MoveTimer.Start();

                ImmortalDelay = 4000;
                Immortal      = true;
            }
            GUIForm.Invalidate(Rect);
        }
Exemple #13
0
    // Use this for initialization
    void Start()
    {
        // Unity Components
        m_rigidbody2D    = GetComponent <Rigidbody2D>();
        m_spriteRenderer = GetComponent <SpriteRenderer>();

        // Custom Components
        Stamina = GetComponent <PlayerStamina>();
        Lives   = GetComponent <PlayerLives>();

        // Setup the Respawn Timer
        RespawnTimer = GetComponent <CountdownTimer>();
        RespawnTimer.StopClockTimer();
        RespawnTimer.OnCompleted += RespawnTimer_OnCompleted;
    }
Exemple #14
0
        private void Playbuttonbox_Click(object sender, EventArgs e)
        {
            RunningState = true;

            timer2.Start();
            timer3.Start();
            SkillTimer1.Start();
            SkillTimer2.Start();
            SkillTimer3.Start();
            SkillTimer4.Start();
            RespawnTimer.Start();
            HpTimer.Start();

            Timer2Runtime = DateTime.Now;
            Timer3Runtime = DateTime.Now;

            PauseButtonBox.Enabled = true;
            Playbuttonbox.Enabled  = false;
        }
Exemple #15
0
    void InitGame()
    {
        //this is just for starting the game without character selection screen
        CharacterAttributes tempAttributes = new CharacterAttributes();

        tempAttributes.m_CharacterType = CharacterAttributes.CharacterType.ROBOT;
        tempAttributes.SetPrefab();
        //if(characterMap.Count == 0) AssignCharacterToMap(1, tempAttributes);

        //set up the respawn timers
        for (int i = 1; i <= characterMap.Count; i++)
        {
            RespawnTimer timer = gameObject.AddComponent <RespawnTimer>();
            timer.Init(respawnTime, i);
            respawnTimers[i] = timer;
        }

        numPlayers = characterMap.Count;
        planets    = GameObject.FindGameObjectsWithTag("Planet");
    }
Exemple #16
0
    public void Hurt()
    {
        if (HoldingShield)
        {
            CanShield     = false;
            HoldingShield = false;
            ShieldTime    = false;
            ShieldCooldown.Start(2.5f);
        }
        else
        {
            Health--;
        }
        Health = Mathf.Max(Health, 0);

        if (Health == 0)
        {
            Animation.Play("Death");
            RespawnTimer.Start(1);
        }
    }
Exemple #17
0
        private void PauseButtonBox_Click(object sender, EventArgs e)
        {
            TimeSpan timer2span = DateTime.Now - Timer2Runtime;
            TimeSpan timer3span = DateTime.Now - Timer3Runtime;

            Timer2SpanTime += Convert.ToInt32(timer2span.TotalMilliseconds);
            Timer3SpanTime += Convert.ToInt32(timer3span.TotalMilliseconds);

            timer2.Stop();
            timer3.Stop();
            SkillTimer1.Stop();
            SkillTimer2.Stop();
            SkillTimer3.Stop();
            SkillTimer4.Stop();
            HpTimer.Stop();
            RespawnTimer.Stop();

            RunningState           = false;
            PauseButtonBox.Enabled = false;
            Playbuttonbox.Enabled  = true;
        }
 // Use this for initialization
 void Start()
 {
     timer = GameObject.FindWithTag("Player").GetComponent<RespawnTimer>();
 }
 public void Init(RespawnTimer _respawnTimer)
 {
     respawnTimer = _respawnTimer;
     timerObj.SetActive(true);
     isActive = true;
 }
 void Start()
 {
     blur = GameObject.Find("Player_Cam").GetComponent<MotionBlur>();
     timer = GameObject.FindWithTag("Player").GetComponent<RespawnTimer>();
     timeLimit = timer.getTimeLimit();
 }