예제 #1
0
        public GameObject Create(GameObject.Name name, AlienCategory.Type type, GameObject pContainer = null, float posX = 0.0f, float posY = 0.0f)
        {
            GameObject pGameObj = null;

            switch (type)
            {
            case AlienCategory.Type.Squid:
                pGameObj = new Squid(GameObject.Name.Squid, GameSprite.Name.Squid, posX, posY);
                AlienCategory pAlienCategory = (AlienCategory)pGameObj;
                pAlienCategory.SetState(AlienMan.State.Ready);
                break;

            case AlienCategory.Type.Crab:
                pGameObj       = new Crab(GameObject.Name.Crab, GameSprite.Name.Crab, posX, posY);
                pAlienCategory = (AlienCategory)pGameObj;
                pAlienCategory.SetState(AlienMan.State.Ready);
                break;

            case AlienCategory.Type.Octopus:
                pGameObj       = new Octopus(GameObject.Name.Octopus, GameSprite.Name.Octopus, posX, posY);
                pAlienCategory = (AlienCategory)pGameObj;
                pAlienCategory.SetState(AlienMan.State.Ready);
                break;

            case AlienCategory.Type.Group:
                pGameObj = new AlienGroup(name, GameSprite.Name.NullObject, posX, posY);
                break;

            case AlienCategory.Type.Column:
                pGameObj = new AlienColumn(name, GameSprite.Name.NullObject, posX, posY);
                break;

            default:
                Debug.Assert(false);
                break;
            }

            // Attached to Group
            this.AttachTo(pGameObj, pContainer);
            return(pGameObj);
        }
예제 #2
0
        public override void Notify()
        {
            //Debug.WriteLine("BombObserver: {0} {1}", this.pSubject.pObjA, this.pSubject.pObjB);
            GameObject placeObject;

            if (this.p == 1)
            {
                placeObject = this.pSubject.pObjA;
            }
            else
            {
                placeObject = this.pSubject.pObjB;
            }

            Bomb pBomb = (Bomb)placeObject;

            GameObject pGameObj = pBomb.getOwned();

            Debug.Assert(pGameObj != null);
            if (pGameObj.GetName() == GameObject.Name.UFO)
            {
                if (pGameObj.bMarkForDeath == false)
                {
                    UFO pUFO = (UFO)pGameObj;
                    pUFO.SetState(UFOMan.State.Flying);
                }
            }
            else
            {
                if (pGameObj.bMarkForDeath == false)
                {
                    AlienCategory pAlien = (AlienCategory)pGameObj;
                    pAlien.SetState(AlienMan.State.Ready);
                }
            }
        }
예제 #3
0
 public override void Handle(AlienCategory pAlien)
 {
     pAlien.SetState(AlienMan.State.BombFlying);
 }