예제 #1
0
        public override void OnControlAcquired(Sandbox.Game.Entities.Character.MyCharacter owner)
        {
            base.OnControlAcquired(owner);

            if (owner == null || owner.Parent == null)
                return;

            if (owner == MySession.Static.LocalCharacter && !owner.Parent.Components.Contains(typeof(MyCasterComponent)))
            {
                MyDrillSensorRayCast raycaster = new MyDrillSensorRayCast(0, DEFAULT_REACH_DISTANCE);
                MyCasterComponent raycastingComponent = new MyCasterComponent(raycaster);
                owner.Parent.Components.Add(raycastingComponent);
                controller = owner;
            }
        }
예제 #2
0
 void OnComponentRemoved(System.Type arg1, MyEntityComponentBase arg2)
 {
     if (arg1 == typeof(MyCasterComponent))
     {
         raycaster = null;
         this.PositionComp.OnPositionChanged -= OnPositionChanged;
     }
 }
예제 #3
0
 void OnComponentAdded(System.Type arg1, MyEntityComponentBase arg2)
 {
     if (arg1 == typeof(MyCasterComponent))
     {
         raycaster = arg2 as MyCasterComponent;
         this.PositionComp.OnPositionChanged += OnPositionChanged;
     }
 }