Example #1
0
        public virtual Emitter <T> OnEmit(T eventType)
        {
            if (!_active)
            {
                return(this);
            }
            int taskCount = 0;
            SortedList <Updateable> list = _emitterTable.Get(eventType);

            if (null != list)
            {
                for (LIterator <Updateable> it = list.ListIterator(); it.HasNext();)
                {
                    Updateable update = it.Next();
                    if (update != null)
                    {
                        update.Action(eventType);
                        if (update is ActionUpdate)
                        {
                            ActionUpdate au = (ActionUpdate)update;
                            if (au.Completed())
                            {
                                list.Remove(au);
                            }
                        }
                    }
                    taskCount++;
                    if (taskCount >= _maxFrameTask)
                    {
                        break;
                    }
                }
            }
            return(this);
        }
Example #2
0
 public void ProcessAction(ActionUpdate au)
 {
     if (au.actionType == Action.MELEE_ATTACK_START) {
         if (au.creatorGUID == this.GUID) {
             this.animationScript.AttackRightArm();
         }
     }
 }
Example #3
0
            public void It_should_trigger_the_Update_action()
            {
                var triggered    = false;
                var actionUpdate = new ActionUpdate((action) => triggered = true);

                actionUpdate.Update();

                Assert.IsTrue(triggered);
            }
 public AdapterInfo(SdkPlatform sdkPlatform, string name, string prettyName, Version version,
                    Integration integration,
                    ActionUpdate action)
 {
     this.sdkPlatform = sdkPlatform;
     this.name        = name;
     pretty_name      = prettyName;
     this.version     = version;
     this.integration = integration;
     this.action      = action;
 }
Example #5
0
    private void HandleActionUpdate(ActionUpdate au)
    {
        if(au.actionType == Action.PROJECTILE_START)
        {
            Vector3 arrowDir = new Vector3(au.dirx, au.diry, au.dirz);
            GameObject templateArrow = GameObject.FindGameObjectWithTag ("Arrow");
            GameObject g = (GameObject)Instantiate(templateArrow, new Vector3(au.posx, au.posy, au.posz), new Quaternion (0, 0, 0, 0));
            ProjectileScript s = g.GetComponent<ProjectileScript>();
            s.orig = g.transform.position;
            s.direction = arrowDir;
            s.speed = 10.0f;
            s.GUID = au.actionGUID;
            this.arrows.Add(s);

            float AngleRad = Mathf.Atan2 (arrowDir.x, -arrowDir.y);
            float AngleDeg = (180 / Mathf.PI) * AngleRad;
            g.transform.rotation = Quaternion.Euler (0, 0, AngleDeg);
            return;
        }

        if(au.creatorGUID == this.player.GUID || au.victimGUID == this.player.GUID)
            this.player.ProcessAction(au);

        foreach(OtherPlayersScript p in this.otherPlayers)
        {
            if(p.GUID == au.creatorGUID || p.GUID == au.victimGUID)
                p.ProcessAction(au);
        }

        if(au.actionType == Action.PROJECTILE_END)
        {
            ProjectileScript arrow = null;
            foreach(ProjectileScript s in this.arrows)
            {
                if(s.GUID == au.actionGUID)
                    arrow = s;
            }
            if(arrow != null)
            {
                this.arrows.Remove(arrow);
                Destroy(arrow.gameObject);
                Destroy(arrow);
            }
            else
            {
                Debug.LogError("Error: Couldn't find arrow to delete");
            }
        }
    }
Example #6
0
 public void delete(Observer observer)
 {
     updatelist -= observer.notified;
 }
Example #7
0
 public void add(Observer observer)
 {
     updatelist += observer.notified;
 }
Example #8
0
 public void Delete(Observer observer)
 {
     updateList -= observer.Notified;
 }
Example #9
0
 public void Add(Observer observer)
 {
     updateList += observer.Notified;
 }
Example #10
0
 public void Del(Observer observer)
 {
     updatelist -= observer.Notified;
 }
Example #11
0
 public void ProcessAction(ActionUpdate au)
 {
     if (au.actionType == Action.MELEE_ATTACK_HIT) {
         if (au.victimGUID == this.GUID) {
             this.damageTaken += au.damage;
         }
         if (au.creatorGUID == this.GUID && au.victimGUID != -1) {
             this.damageDone += au.damage;
         }
     }
     if (au.actionType == Action.PROJECTILE_END) {
         if (au.victimGUID == this.GUID) {
             this.damageTaken += au.damage;
         }
         if (au.creatorGUID == this.GUID && au.victimGUID != -1) {
             this.damageDone += au.damage;
         }
     }
 }