コード例 #1
0
        /// <summary>
        /// Called when a component is removed from the world
        /// </summary>
        /// <param name="compo">Component</param>
        /// <returns>Returns true if successfully removed otherwise false</returns>
        public override bool Unregister(Component compo)
        {
            if (compo == null)
                return false;

            Type componentType = compo.GetType();
            if (componentType == typeof(HealthComponent))
                RemoveHealth(compo as HealthComponent);
            else if (componentType == typeof(ShieldComponent))
                RemoveShield(compo as ShieldComponent);

            return true;
        }
コード例 #2
0
        /// <summary>
        /// Called when a new component is added to the world
        /// </summary>
        /// <param name="compo">Component</param>
        public override void Register(Component compo)
        {
            if(compo == null)
                throw new ArgumentNullException("compo");

            Type componentType = compo.GetType();
            if (componentType == typeof (HealthComponent))
                ActivateHealth(compo as HealthComponent);
            else if (componentType == typeof (ShieldComponent))
                ActivateShield(compo as ShieldComponent);
        }
コード例 #3
0
        public override bool Unregister(Component compo)
        {
            PoisonComponent poison = compo as PoisonComponent;
            if(poison == null)
                throw new ArgumentException();

            return _components.Remove(poison);
        }
コード例 #4
0
        public override void Register(Component compo)
        {
            PoisonComponent poison = compo as PoisonComponent;
            if(poison == null)
                throw new ArgumentException();

            _components.Add(poison);
        }
コード例 #5
0
ファイル: System.cs プロジェクト: Julien-Pires/Pulsar
 /// <summary>
 /// Unregisters a component
 /// </summary>
 /// <param name="compo">Component to unregister</param>
 /// <returns>Return true if the component is removed successfully otherwise false</returns>
 public abstract bool Unregister(Component compo);
コード例 #6
0
ファイル: System.cs プロジェクト: Julien-Pires/Pulsar
 /// <summary>
 /// Registers a component
 /// </summary>
 /// <param name="compo">Component to register</param>
 public abstract void Register(Component compo);