Beispiel #1
0
 public void UseSkill(int index, MmoActor player)
 {
     if (index >= 0 && index < useSkills.Count)
     {
         useSkills[index].Use(player);
     }
 }
Beispiel #2
0
 public MmoItem(PeerBase peer, InterestArea interest, IWorld world, GameApplication app, float[] coordinate, float[] rotation,
                Hashtable properties, string gameRefId, Dictionary <byte, object> inTags, float size, int subZone, BehaviourCollection collection)
     : base(coordinate.ToVector(false), properties, gameRefId, (byte)ItemType.Avatar, world, peer.RequestFiber, false, inTags, size, subZone, collection)
 {
     owner = GetComponent <MmoActor>();
     owner.SetApplication(app);
     owner.SetPeer(peer);
     owner.SetAvatar(this);
     owner.AddInterestArea(interest);
     owner.SetWorld(world);
     transform.SetPosition(coordinate);
     transform.SetRotation(rotation);
 }
Beispiel #3
0
 public static bool CheckMmoActor <T>(this MmoActor actor) where T : class
 {
     if (actor == null)
     {
         return(false);
     }
     if (actor.Avatar == null)
     {
         return(false);
     }
     if (actor.Avatar.Disposed)
     {
         return(false);
     }
     return(actor is T);
 }
Beispiel #4
0
 public PlayerShipEnergyBlock(MmoActor actor)
 {
     this.actor       = actor;
     this.energyBuffs = new Dictionary <string, float>();
 }
Beispiel #5
0
        public void UpdateSkills(ShipModel model)
        {
            string[] skills = model.Skills;

            List <int> removedIndices = new List <int>();

            for (int i = 0; i < this.useSkills.Count; i++)
            {
                if (false == skills.Contains(this.useSkills[i].ID))
                {
                    removedIndices.Add(i);
                }
            }

            foreach (int removeIndex in removedIndices)
            {
                if (this.useSkills[removeIndex] != null)
                {
                    this.useSkills[removeIndex].Release();
                }

                this.useSkills[removeIndex] = new EmptySkill();
            }

            List <int> freeIndices = new List <int>();

            for (int i = 0; i < this.useSkills.Count; i++)
            {
                if (this.useSkills[i].IsEmpty)
                {
                    freeIndices.Add(i);
                }
            }

            Dictionary <int, string> newSkills = new Dictionary <int, string>();
            int counter = 0;

            foreach (string skill in skills)
            {
                if (false == this.IsUseSkill(skill))
                {
                    newSkills.Add(freeIndices[counter++], skill);
                }
            }

            foreach (var pair in newSkills)
            {
                UseSkill s = this.GetAvailableSkill(pair.Value);
                if (s != null)
                {
                    this.useSkills[pair.Key] = s;
                }
            }

            if (string.IsNullOrEmpty(model.Sets.FullSetSkill))
            {
                this.useSkills[5] = EmptySkill.Get;
            }
            else
            {
                UseSkill skill = this.GetAvailableSkill(model.Sets.FullSetSkill);
                this.useSkills[5] = (skill != null) ? skill : EmptySkill.Get;
            }

            //generate update skills event when method colled
            if (_owner != null)
            {
                MmoActor actor = this._owner as MmoActor;
                if (actor != null)
                {
                    actor.EventOnSkillsUpdated();
                }
            }
            //owner sent skills updated
        }
Beispiel #6
0
 public bool GrantWriteAccess(MmoActor actor)
 {
     return(this.owner == actor);
 }