Exemple #1
0
        public override void populate(Island curr, Random random)
        {
            Vector3 pos = this.findRandomPoint(curr, random);
            int tmp = 0;

            string brick = "Sand";

            curr.setBlockAt((int)pos.x, (int)pos.y, (int)pos.z, brick, true);
            for (int y = 0; y < 18; y++)
            {
                for (int x = 0 + tmp; x < _width - tmp; x++)
                {
                    for (int z = 0 + tmp; z < _width - tmp; z++) {

                        if (y == 0 || y == 7)
                            curr.setBlockAt((int)pos.x + x, (int)pos.y + y - 7, (int)pos.z + z, brick, true);
                        else if ((x == 0 || z == 0 || x == _width - 1 || z == _width - 1) && y <= 6)
                            curr.setBlockAt((int)pos.x + x, (int)pos.y + y - 7, (int)pos.z + z, brick, true);
                        else if (y > 7)
                            curr.setBlockAt((int)pos.x + x, (int)pos.y + y - 7, (int)pos.z + z, brick, true);
                        else
                            curr.setBlockAt((int)pos.x + x, (int)pos.y + y - 7, (int)pos.z + z, "Air", true);
                    }
                }
                if (y >= 7)
                    tmp++;
            }

            CharacterInfo iaInfo = new CharacterInfo("Robot-" + Guid.NewGuid().ToString(), Faction.Red);

            iaInfo.SpawnPoint = new Vector3(pos.x + _width / 2 - 4, (int)pos.y - 5, (int)pos.z + _width / 2) * Cst.CUBE_SIDE;
            curr.mWorld.getStateMgr().MainState.CharacMgr.AddCharacter(iaInfo);

            iaInfo = new CharacterInfo("Robot-" + Guid.NewGuid().ToString(), Faction.Red);
            iaInfo.SpawnPoint = new Vector3(pos.x + _width / 2 + 4, (int)pos.y - 5, (int)pos.z + _width / 2) * Cst.CUBE_SIDE;
            curr.mWorld.getStateMgr().MainState.CharacMgr.AddCharacter(iaInfo);

            Portals.makePortal(1, curr, new Vector3((int)pos.x + _width / 2 - 2, (int)pos.y - 7, (int)pos.z + _width / 2 - 3));

            int tmp2 = 0;
            for (int y = 1; y < 6; y++)
            {
                for (int x = 0; x < 2; x++)
                {
                    for (int z = tmp2; z < tmp2 + 2; z++)
                    {
                        curr.setBlockAt((int)pos.x + _width / 2 - 1 + x, (int)pos.y + y - 8, (int)pos.z + _width - 1 + z, brick, true);
                        curr.setBlockAt((int)pos.x + _width / 2 - 1 + x, (int)pos.y + y - 7, (int)pos.z + _width - 1 + z, "Air", true);
                        curr.setBlockAt((int)pos.x + _width / 2 - 1 + x, (int)pos.y + y - 5, (int)pos.z + _width - 1 + z, "Air", true);
                        curr.setBlockAt((int)pos.x + _width / 2 - 1 + x, (int)pos.y + y - 6, (int)pos.z + _width - 1 + z, "Air", true);

                    }
                }
                tmp2++;
            }
        }
        // Called by VanillaRTS only
        public void CreateUnit()
        {
            if (!this.CanCreateUnit) { return; }

            this.RTS.Crystals -= ROBOT_COST;
            this.RTS.AmountUnits++;
            CharacterInfo info = new CharacterInfo("Robot", this.RTS) {SpawnPoint = this.mSpawnPoint};
            int id = info.Id;
            this.mStateMgr.MainState.CharacMgr.AddCharacter(info);
            if(this.mSymetricFactor == 1)
                this.mStateMgr.MainState.CharacMgr.GetCharacterById(id).YawTo(180);
            //VanillaCharacter charac = this.mStateMgr.MainState.CharacMgr.GetCharacterById(id);
            //charac.SetForcedDest((this.Position + new Vector3(0, 1, 2 * this.mSymetricFactor)) * Cst.CUBE_SIDE);
            this.mTimeSinceLastPop.Reset();
            this.mHasCreateOneUnit = true;
        }
        public VanillaPlayer(CharacMgr characMgr, string meshName, CharacterInfo info)
            : base(characMgr, info)
        {
            SceneManager sceneMgr = characMgr.SceneMgr;
            Entity ent = sceneMgr.CreateEntity("CharacterEnt_" + this.mCharInfo.Id, meshName);
            ent.Skeleton.BlendMode = SkeletonAnimationBlendMode.ANIMBLEND_CUMULATIVE;
            Entity swordL = sceneMgr.CreateEntity("Sword.mesh");
            ent.AttachObjectToBone("Sheath.L", swordL);
            Entity swordR = sceneMgr.CreateEntity("Sword.mesh");
            ent.AttachObjectToBone("Sheath.R", swordR);
            this.mMesh = new Sinbad(ent);

            this.mNode = characMgr.SceneMgr.RootSceneNode.CreateChildSceneNode("CharacterNode_" + this.mCharInfo.Id, Vector3.ZERO, this.mMesh.InitialOrientation);
            this.mNode.AttachObject(ent);
            this.mNode.Scale(this.mMesh.MeshSize / ent.BoundingBox.Size);
            this.mNode.Orientation = this.mMesh.InitialOrientation;

            this.mShootCube = new ShootCube(this.mCharacMgr.BulletMgr, this);
            this.FinishCreation();
        }
 public void createAndSpawnEntity(Vector3 point, CharacterInfo c)
 {
     this.mStateMgr.MainState.CharacMgr.AddCharacter(c);
 }