コード例 #1
0
        public Goriya(Vector2 pos, string color = "red")
        {
            GetComponent <Transform>().position = pos;
            BasicSprite spriteImage;

            switch (color.ToLower())
            {
            case "red":
                spriteImage = EnemySpriteFactory.Instance.CreateRedGoriyaRight();
                break;

            case "blue":
                spriteImage = EnemySpriteFactory.Instance.CreateBlueGoriyaRight();
                break;

            default:
                // Console.WriteLine("Goriya @ Goriya(string color): Unrecognized color! Defaulting to red.");
                color       = "red";
                spriteImage = EnemySpriteFactory.Instance.CreateRedGoriyaRight();
                break;
            }

            // add sprite component
            Sprite sprite = new Sprite(spriteImage);

            AddComponent(sprite);
            sprite.SetAnimate(true);

            // add behavior component
            BehaviorScript behavior = new GoriyaBehavior(color);

            AddComponent(behavior);

            var coll = new Collider();

            coll.response = new EnemyCollisionResponse(this, Constants.GORIYA_CONTACT_DAMAGE);
            AddComponent(coll);
            Constants.SetLayerDepth(this, Constants.LayerDepth.Enemy);

            BehaviorScript health = new EnemyHealthManagement(Constants.GORIYA_HEALTH);

            AddComponent(health);
        }
コード例 #2
0
        public Keese(Vector2 pos)
        {
            GetComponent <Transform>().position = pos;

            BasicSprite spriteImage = EnemySpriteFactory.Instance.CreateBlueKeese();
            Sprite      sprite      = new Sprite(spriteImage);

            AddComponent(sprite);

            BehaviorScript movement = new KeeseMovement();

            AddComponent(movement);

            var coll = new Collider();

            coll.response = new KeeseCollisionResponse(this, Constants.KEESE_CONTACT_DAMAGE);
            AddComponent(coll);
            Constants.SetLayerDepth(this, Constants.LayerDepth.Enemy);

            BehaviorScript health = new EnemyHealthManagement(Constants.KEESE_HEALTH);

            AddComponent(health);
        }
コード例 #3
0
        public WallMaster(Vector2 pos, Constants.Direction startingDirection)
        {
            GetComponent <Transform>().position = pos;

            BasicSprite spriteImage = EnemySpriteFactory.Instance.CreateWallMasterRight();
            Sprite      sprite      = new Sprite(spriteImage);

            AddComponent(sprite);
            sprite.SetAnimate(true);

            BehaviorScript state = new WallMasterMovement(startingDirection);

            AddComponent(state);

            var coll = new Collider();

            coll.response = new EnemyCollisionResponse(this, Constants.STALFO_CONTACT_DAMAGE);
            AddComponent(coll);
            Constants.SetLayerDepth(this, Constants.LayerDepth.Enemy);

            BehaviorScript health = new EnemyHealthManagement(Constants.WALLMASTER_HEALTH);

            AddComponent(health);
        }
コード例 #4
0
        public BladeTrap(Vector2 pos)
        {
            GetComponent <Transform>().position = pos;

            BasicSprite spriteImage = EnemySpriteFactory.Instance.CreateBladeTrap();
            Sprite      sprite      = new Sprite(spriteImage);

            AddComponent(sprite);
            sprite.SetAnimate(false);

            BehaviorScript movement = new BladeTrapMovement();

            AddComponent(movement);

            var coll = new Collider();

            coll.response = new BladeTrapCollisionResponse(this, Constants.BLADETRAP_CONTACT_DAMAGE);
            AddComponent(coll);
            Constants.SetLayerDepth(this, Constants.LayerDepth.Enemy);

            BehaviorScript health = new EnemyHealthManagement(Constants.BLADETRAP_HEALTH);

            AddComponent(health);
        }