コード例 #1
0
ファイル: River.cs プロジェクト: rossstyants/FleeceLightning
        }                                                      ////@property(readonly) NoGoZone* noGoStem;

        public FlowerCliff()
        {
            //if (!base.init()) return null;

            noGoStem = new NoGoZone();
            //return this;
        }
コード例 #2
0
 public void Dealloc()
 {
     if (noGoZone != null)
     {
         noGoZone.Dealloc();
         noGoZone = null;
     }
 }
コード例 #3
0
        }                                                               ///@property(readwrite,assign) int crossingThingId;

//public void SetStillHasMapObject(bool inThing) {stillHasMapObject = inThing;}///@property(readwrite,assign) bool stillHasMapObject;

        public CrossingThing()
        {
            //if (!base.init()) return null;

            whichHoof = 0;
            distanceBetweenHoofSounds = 0.0f;
            distSinceCloud            = 0.0f;
            noGoZone = null;
            //return this;
        }
コード例 #4
0
        public void AddToScene(CrossingThingInfo info)
        {
            numAnims = -1;
            switch ((CrossingThingType)info.crossingThingType)
            {
            case CrossingThingType.kCrossingThing_Elephant:
                xSpeed = -1.0f;
                break;

            case CrossingThingType.kCrossingThing_Snake:
                xSpeed            = -2.0f;
                animMinSubTexture = 0;                //kGTJungle_Snake1;
                numAnims          = 3;
                break;

            case CrossingThingType.kCrossingThing_Shirley:
                xSpeed            = 0.5f;
                animMinSubTexture = 0;
                numAnims          = 3;
                break;

            case CrossingThingType.kCrossingThing_Tractor:
                xSpeed            = -3.0f;
                animMinSubTexture = (short)World.Enum2.kGTMud_Tractor;
                numAnims          = 1;
                break;

            case CrossingThingType.kCrossingThing_LandRover:
                xSpeed            = 4.5f;
                animMinSubTexture = (short)World.Enum2.kGTMud_LandRover;
                numAnims          = 1;
                break;

            case CrossingThingType.kCrossingThing_Sheep:
                xSpeed = info.xSpeed;
                if (xSpeed < 0.0f)
                {
                    animMinSubTexture = (short)World.Enum3.kGTGrass_CowLeft1;
                }
                else
                {
                    animMinSubTexture = (short)World.Enum3.kGTGrass_CowRight1;
                }

                numAnims = 3;
                break;

            default:
                xSpeed = -1.0f;
                break;
            }

            framesToCrossMap  = (short)((Constants.MAP_WIDTH + (kMapEdgeBuffer * 2.0f)) / -xSpeed);
            startPosition     = info.startPosition;
            position          = info.startPosition;
            crossingThingType = info.crossingThingType;
            crossingThingId   = info.crossingThingId;
            mapObjectId       = (short)(Globals.g_world.game).AddMapObjectP1P2P3P4((TextureType)0, (int)100, (int)-300, ListType.e_RenderAbovePlayer, 0.0f);
            Globals.Assert(!(Globals.g_world.game).IsMapObjectIdInvalid(mapObjectId));
            mapObject = (Globals.g_world.game).GetMapObject(mapObjectId);
            mapObject.SetType(MapObjectType.e_CrossingThing);
            mapObject.SetSubTextureId(animMinSubTexture);
            if (((Globals.g_world.game).lBuilder).currentScene == (int)SceneType.kSceneMud)
            {
                mapObject.SetRotationScale((Globals.g_world.GetAtlas(AtlasType.kAtlas_GameThingsMud)).GetSubTextureRotationScale(animMinSubTexture));
            }
            else
            {
                mapObject.SetRotationScale((Globals.g_world.GetAtlas(AtlasType.kAtlas_GameThingsGrass)).GetSubTextureRotationScale(animMinSubTexture));
            }

            mapObject.SetIsSelfRemoving(false);
            mapObject.SetScale(Constants.SPRITE_BASE_SCALE);
            shadowMapObjectId = -1;
            if ((int)crossingThingType == (int)CrossingThingType.kCrossingThing_Elephant)
            {
                shadowMapObjectId = (short)(Globals.g_world.game).AddMapObjectP1P2P3P4((TextureType)0, (int)-100, (int)-300, ListType.e_Shadows, 0);
            }

            Globals.Assert(!(Globals.g_world.game).IsMapObjectIdInvalid(mapObjectId));
            if ((int)crossingThingType == (int)CrossingThingType.kCrossingThing_Elephant)
            {
                Globals.Assert(!(Globals.g_world.game).IsMapObjectIdInvalid(shadowMapObjectId));
                shadowMapObject = (Globals.g_world.game).GetMapObject(shadowMapObjectId);
                shadowMapObject.SetSubTextureId(1);
                shadowMapObject.SetIsSelfRemoving(false);
            }

            float noGoRadius = 0.0f;

            if ((int)crossingThingType == (int)CrossingThingType.kCrossingThing_Elephant)
            {
                shadowMapObject.SetScale(2.0f);
                noGoRadius = 42.0f;
            }
            else if ((int)crossingThingType == (int)CrossingThingType.kCrossingThing_Snake)
            {
                noGoRadius = 30.0f;
            }
            else if ((int)crossingThingType == (int)CrossingThingType.kCrossingThing_Shirley)
            {
                noGoRadius = 50.0f;
            }
            else if ((int)crossingThingType == (int)CrossingThingType.kCrossingThing_Sheep)
            {
                noGoRadius = 30.0f;
            }
            else if (((int)crossingThingType == (int)CrossingThingType.kCrossingThing_Tractor) || ((int)crossingThingType == (int)CrossingThingType.kCrossingThing_LandRover))
            {
                noGoRadius = 80.0f;
            }
            else
            {
                Globals.Assert(false);
            }

            if (noGoZone == null)
            {
                noGoZone = new NoGoZone();
            }

            noGoZone.InitialiseP1(Utilities.CGPointMake(0, 0), noGoRadius);
            noGoZone.SetType(NoGoType.e_CrossingThing);
            noGoZone.SetObjectId(crossingThingId);
            noGoZone.SetShadowObjectId(crossingThingId);
            noGoZone.SetIsBouncable(true);
            noGoZone.SetCeilingHeight(20.0f);
        }
コード例 #5
0
        public void AddToFlockP1(Flock.FlockAnimalInfo info, FlockAnimal prevAnimal)
        {
            myFlock          = info.myFlock;
            xLinePosition    = info.xLinePosition;
            position.x       = info.xLinePosition;
            position.y       = myFlock.yPositionStart;
            yUndulationTimer = info.yUndulationTimer;
            yUndulationTime  = info.yUndulationTime;
            flockAnimalType  = (FlockAnimalType)info.animalType;
            flockAnimalId    = info.flockAnimalId;
            hasMarkerForAI   = info.hasMarkerForAI;
            markerOffset     = info.markerOffset;
            if (flockAnimalType == FlockAnimalType.kFlockAnimalShirley)
            {
                undulationDistance = 20.0f;
            }
            else
            {
                undulationDistance = 40.0f;
            }

            if (flockAnimalType == FlockAnimalType.kFlockAnimalPenguin)
            {
                hasShadow = false;
            }
            else
            {
                hasShadow = true;
            }

            framesForUndulationCycle = (int)(info.yUndulationTime / Constants.kFrameRate);
            if (prevAnimal == null)
            {
                yStartPosition = myFlock.yPositionStart;
                int framesAdded = (int)(info.yUndulationTimer / Constants.kFrameRate);
                undulationStartFrame = (int)(framesAdded % framesForUndulationCycle);
                if (undulationStartFrame < 0)
                {
                    undulationStartFrame += framesForUndulationCycle;
                }
            }
            else
            {
                yStartPosition = prevAnimal.yStartPosition - info.distanceToGo;
                float distanceFromStart = myFlock.yPositionStart - yStartPosition;
                int   framesSinceStart  = (int)(distanceFromStart / myFlock.speed);
                int   framesAdded       = (int)((info.yUndulationTimer) / Constants.kFrameRate);
                int   totalNewFrames    = -framesSinceStart + framesAdded;
                undulationStartFrame = (int)(totalNewFrames % framesForUndulationCycle);
                if (undulationStartFrame < 0)
                {
                    undulationStartFrame += framesForUndulationCycle;
                }
            }

            mapObjectId = (Globals.g_world.game).AddMapObjectP1P2P3P4(TextureType.kTexture_DontAddThisMapObjectToPendingList, (int)100, (int)-300,
                                                                      ListType.e_RenderAbovePlayer, 0);
            Globals.Assert(!(Globals.g_world.game).IsMapObjectIdInvalid(mapObjectId));
            mapObject = (Globals.g_world.game).GetMapObject(mapObjectId);
            mapObject.SetType(MapObjectType.e_FlockAnimal);
            mapObject.SetSubTextureId(0);
            const float kMinScale = 0.73f;
            const float kMaxScale = 1.0f;
            float       range     = kMaxScale - kMinScale;
            float       rPlus     = Utilities.GetRandBetweenP1(0.0f, range);
            float       rThing    = kMinScale + rPlus;

            mapObject.SetScale(rThing);
            mapObject.SetIsSelfRemoving(false);
            shadowMapObjectId = -1;
            if (hasShadow)
            {
                shadowMapObjectId = (Globals.g_world.game).AddMapObjectP1P2P3P4(TextureType.kTexture_DontAddThisMapObjectToPendingList, (int)-100, (int)-300,
                                                                                ListType.e_Shadows, 0);
            }

            Globals.Assert(!(Globals.g_world.game).IsMapObjectIdInvalid(mapObjectId));
            if (hasShadow)
            {
                Globals.Assert(!(Globals.g_world.game).IsMapObjectIdInvalid(shadowMapObjectId));
                shadowMapObject = (Globals.g_world.game).GetMapObject(shadowMapObjectId);
                shadowMapObject.SetIsSelfRemoving(false);

                shadowMapObject.SetAtlas(Globals.g_world.game.gameThingsAtlas);                //
                if (((Globals.g_world.game).lBuilder).currentScene == (int)SceneType.kSceneMud)
                {
                    shadowMapObject.SetSubTextureId((int)World.Enum2.kGTMud_PlayerShadow);
                    shadowMapObject.SetAtlas(Globals.g_world.game.gameThingsAtlas);// .SetSubTextureId((int)World.Enum2.kGTMud_PlayerShadow);
                }
                else
                {
                    shadowMapObject.SetSubTextureId((int)World.Enum3.kGTGrass_PlayerShadow);
                }
            }

            float noGoRadius = 0.0f;

            if (flockAnimalType == FlockAnimalType.kFlockAnimalCow)
            {
                shadowMapObject.SetScale(1.0f);
                noGoRadius = 42.0f;
            }
            else if (flockAnimalType == FlockAnimalType.kFlockAnimalSheep)
            {
                shadowMapObject.SetScale(1.7f * rThing);
                noGoRadius = 42.0f;
            }
            else if (flockAnimalType == FlockAnimalType.kFlockAnimalPenguin)
            {
                noGoRadius = 20.0f;
            }
            else if (flockAnimalType == FlockAnimalType.kFlockAnimalZebra)
            {
                shadowMapObject.SetScale(1.5f);
                noGoRadius = 35.0f;
            }
            else if (flockAnimalType == FlockAnimalType.kFlockAnimalShirley)
            {
                shadowMapObject.SetScale(2.7f);
                noGoRadius = 70.0f;
            }
            else
            {
                Globals.Assert(false);
            }

            if (noGoZone == null)
            {
                noGoZone = new NoGoZone();
            }

            noGoZone.InitialiseP1(Utilities.CGPointMake(0, 0), noGoRadius);
            noGoZone.SetType(NoGoType.e_FlockAnimal);
            noGoZone.SetObjectId(myFlock.flockId);
            noGoZone.SetShadowObjectId(flockAnimalId);
        }
コード例 #6
0
ファイル: River.cs プロジェクト: rossstyants/FleeceLightning
        }                                                         ///@property(readwrite,assign) RiverType riverType;

        public void SetNoGoStem(NoGoZone inThing)
        {
            noGoStem = inThing;
        }                                                      ////@property(readonly) NoGoZone* noGoStem;