コード例 #1
0
ファイル: GameObjectFactory.cs プロジェクト: lab132/owlicity
        public static HomingComponent CreateDefaultHomingCircle(
            GameObject owner,
            BodyComponent bodyComponentToMove,
            float sensorRadius,
            HomingType homingType,
            float homingSpeed)
        {
            var tsc = new TargetSensorComponent(owner)
            {
                TargetCollisionCategories = CollisionCategory.Owliver,
                SensorType         = TargetSensorType.Circle,
                CircleSensorRadius = sensorRadius,
            };

            tsc.AttachTo(bodyComponentToMove);

            var hoc = new HomingComponent(owner)
            {
                BodyComponentToMove = bodyComponentToMove,
                TargetSensor        = tsc,
                Speed      = homingSpeed,
                HomingType = homingType,

                DebugDrawingEnabled = true,
            };

            hoc.AttachTo(bodyComponentToMove);

            return(hoc);
        }
コード例 #2
0
ファイル: SpikeTrap.cs プロジェクト: lab132/owlicity
        public SpikeTrap()
        {
            FixedOrigin = new SpatialComponent(this);

            TargetSensor = new TargetSensorComponent(this)
            {
                SensorType = TargetSensorType.Rectangle,
                TargetCollisionCategories = CollisionCategory.Friendly,
            };
            TargetSensor.AttachTo(FixedOrigin);

            MovingBodyComponent = new BodyComponent(this)
            {
                InitMode = BodyComponentInitMode.Manual,
            };
            RootComponent = MovingBodyComponent;

            Animation = new SpriteAnimationComponent(this)
            {
                AnimationTypes = new List <SpriteAnimationType>
                {
                    SpriteAnimationType.Shopkeeper_Idle_Front
                },
            };
            Animation.AttachTo(this);
        }
コード例 #3
0
ファイル: Singer.cs プロジェクト: lab132/owlicity
        public Singer()
        {
            BodyComponent = new BodyComponent(this)
            {
                InitMode = BodyComponentInitMode.Manual,
            };
            RootComponent = BodyComponent;

            TargetSensor = new TargetSensorComponent(this)
            {
                SensorType                = TargetSensorType.Circle,
                CircleSensorRadius        = SensorReach,
                TargetCollisionCategories = CollisionCategory.Friendly,
            };
            TargetSensor.AttachTo(RootComponent);

            Animation = new SpriteAnimationComponent(this)
            {
                AnimationTypes = new List <SpriteAnimationType>
                {
                    SpriteAnimationType.Singer_Idle_Left,
                    SpriteAnimationType.Singer_Idle_Right,
                },
            };
            Animation.AttachTo(RootComponent);

            Health = GameObjectFactory.CreateDefaultHealth(this,
                                                           maxHealth: 3,
                                                           hitDuration: HitDuration,
                                                           deathParticleTimeToLive: TimeSpan.FromSeconds(1));

            HealthDisplay = new HealthDisplayComponent(this)
            {
                Health     = Health,
                HealthIcon = SpriteAnimationFactory.CreateAnimationInstance(SpriteAnimationType.Cross),
            };
            HealthDisplay.AttachTo(Animation);
        }