예제 #1
0
    public void Dead(int id)
    {
        NetInt dead = new NetInt();

        dead.value = id;
        nm.nc.Send(904, dead);
        UI.transform.localScale = new Vector3(0, 0, 0);
        respawnTimer.Start(nm.getConfiguration().respawnTime, "Sei stato eliminato da " + players[id].gameObject.transform.Find("username").GetComponent <TextMesh>().text);
        enemy e = players[id].GetComponent <enemy>();

        e.addKill();

        if (e.getKills() > maxPoints)
        {
            setRecordHolder(id, e.getKills());
        }
    }
예제 #2
0
 public override void SetNewStageParameters()
 {
     MoveToStartPosition();
     Dx        = 0;
     Dy        = 0;
     Direction = Direction.Up;
     Immortal  = false;
     MoveTimer.Stop();
     RespawnTimer.Start();
 }
예제 #3
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;
     }
 }
예제 #4
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();
 }
            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();
            }
예제 #6
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();
                }
            }
예제 #8
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;
        }
예제 #9
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);
        }
    }