示例#1
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (from == null || targeted == null || this.m_gauntlet == null || this.m_team == 0)
                {
                    return;
                }

                if (targeted is IPoint3D)
                {
                    IPoint3D p = targeted as IPoint3D;

                    CTFBase newbase = this.m_gauntlet.FindBase(this.m_team);

                    if (newbase == null)
                    {
                        newbase = new CTFBase(this.m_gauntlet, this.m_team);
                        // add the base to the gauntlet list
                        this.m_gauntlet.HomeBases.Add(newbase);
                    }

                    newbase.MoveToWorld(new Point3D(p), from.Map);

                    // clear all acceptances
                    this.m_gauntlet.ResetAcceptance();

                    // refresh all gumps
                    RefreshAllGumps(this.m_gauntlet, true);
                    // refresh the gump with the new member
                    //from.SendGump( new CTFGump( m_gauntlet, from));
                }
            }
示例#2
0
    private void CalculateCurrentBase()
    {
        Collider[] hitColliders = Physics.OverlapBox(transform.position, new Vector3(0.001f, 10f, 0.001f));
        CurrentBase = Teams.Neutral;

        foreach (Collider hitCollider in hitColliders)
        {
            CTFBase ctfBase = hitCollider.gameObject.GetComponent <CTFBase>();

            if (ctfBase == null)
            {
                continue;
            }

            CurrentBase = ctfBase.Team;
            return;
        }
    }
示例#3
0
            public override void OnResponse(NetState state, RelayInfo info)
            {
                if (state == null || info == null || state.Mobile == null || this.m_gauntlet == null)
                {
                    return;
                }

                switch (info.ButtonID)
                {
                default:
                {
                    // base buttons
                    if (info.ButtonID >= 1000)
                    {
                        int team = info.ButtonID - 1000;
                        //state.Mobile.Target = new CTFBaseTarget(m_gauntlet, team);

                        //   for hardcoded base locations instead of manually placed
                        // comment out the Target line above  and uncomment the code below
                        //

                        Point3D baseloc = Point3D.Zero;
                        switch (team)
                        {
                        // hardcode the base locations for as many teams as you would like
                        case 1:
                            baseloc = new Point3D(5450, 1150, 0);
                            break;

                        case 2:
                            baseloc = new Point3D(5500, 1150, 0);
                            break;

                        case 3:
                            baseloc = new Point3D(5450, 1150, 0);
                            break;

                        case 4:
                            baseloc = new Point3D(5500, 1150, 0);
                            break;
                        }
                        CTFBase newbase = this.m_gauntlet.FindBase(team);

                        if (baseloc != Point3D.Zero)
                        {
                            if (newbase == null)
                            {
                                newbase = new CTFBase(this.m_gauntlet, team);
                                // add the base to the gauntlet list
                                this.m_gauntlet.HomeBases.Add(newbase);
                            }

                            newbase.MoveToWorld(new Point3D(baseloc), state.Mobile.Map);
                        }

                        state.Mobile.SendGump(new TeamsGump(this.m_gauntlet, state.Mobile));
                    }
                    break;
                }
                }
            }