コード例 #1
0
 public virtual void AddEarth(EarthType type)
 {
     if ((!HasEarth))
     {
         m_EarthType = type;
     }
 }
コード例 #2
0
        public Level(EarthType strataType, int strataDepth, GameObject container, Transform previousTransform)
        {
            LevelStrataType = strataType;
            StrataDepth     = strataDepth;

            quad                       = GameObject.CreatePrimitive(PrimitiveType.Quad);
            strataMaterial             = new Material(Shader.Find("Mobile/Particles/Alpha Blended"));
            strataMaterial.mainTexture = Resources.Load(GameConstants.EarthLayers[strataType].mMaterialName) as Texture;

            strataMaterial.mainTextureScale         = new Vector2(1, (strataType == EarthType.CORE) ? 1 : strataDepth * 0.6f);
            quad.GetComponent <Renderer>().material = strataMaterial;
            materialOffset = strataMaterial.GetTextureOffset("_MainTex");
            quad.transform.SetParent(container.transform);

            float quadHeight = Camera.main.orthographicSize * 2.0f;
            float quadWidth  = quadHeight * Screen.width / Screen.height;
            float scale      = (Screen.height / 2.0f) / Camera.main.orthographicSize;

            quad.transform.localScale = new Vector3(quadWidth, StrataDepth, 1);

            if (previousTransform == null)
            {
                quad.transform.localPosition = new Vector3(0, -StrataDepth / 2.0f, 1);
            }
            else
            {
                quad.transform.localPosition = new Vector3(0, (previousTransform.localPosition.y - previousTransform.localScale.y / 2 - StrataDepth / 2), 1);
            }

            startPosition = quad.transform.localPosition;
            isLast        = false;
        }
コード例 #3
0
        public Earth(EarthType type) : base(0xF3B)
        {
            Name    = "terre";
            Weight  = 10.0;
            Movable = false;

            m_EarthType = type;
        }
コード例 #4
0
ファイル: BotaniqueSystem.cs プロジェクト: jicomub/Temrael
 public static string GetEarthName(EarthType type, bool majuscule)
 {
     if (majuscule)
     {
         return(m_EarthNameM[(int)type]);
     }
     else
     {
         return(m_EarthName[(int)type]);
     }
 }
コード例 #5
0
ファイル: EarthFactory.cs プロジェクト: yening520/MapzenGo
 private void CreateGameObject(EarthType kind, MeshData meshdata, Transform parent)
 {
     var go = new GameObject(kind + " Earths");
     var mesh = go.AddComponent<MeshFilter>().mesh;
     go.AddComponent<MeshRenderer>();
     mesh.vertices = meshdata.Vertices.ToArray();
     mesh.triangles = meshdata.Indices.ToArray();
     mesh.RecalculateNormals();
     go.GetComponent<MeshRenderer>().material = FactorySettings.GetSettingsFor<EarthSettings>(kind).Material;
     go.transform.position += Vector3.up * Order;
     go.transform.SetParent(parent, true);
 }
コード例 #6
0
        void Start()
        {
            playerController = GameObject.Find("Player").GetComponent <PlayerController>();

            backgroundContainer = GameObject.Find("EarthLevels");
            mEarthLevels        = new Level[(2 * GameConstants.TotalDepth / GameConstants.RandomSnapValue) + 1];

            sky = GameObject.Find("Sky");
            Transform prevTransform = sky.transform;

            offset      = -sky.transform.localScale.y / 2 + screenHalfHeight - sky.transform.position.y;
            scrollLimit = GameConstants.TotalDepth + 9.5f + sky.transform.localScale.y + offset - playerController.gameObject.transform.position.y - screenHalfHeight * 2;
            int       i, newDepth = 0, newEarth;
            int       numEarthTypes   = Enum.GetNames(typeof(EarthType)).Length;
            int       strataDivision  = mEarthLevels.Length / 3;
            EarthType strataEarthType = EarthType.SOFT_MUD;

            for (i = 0; i < mEarthLevels.Length - 1; i++)
            {
                //if(i%2 == 0)
                //	newDepth = UnityEngine.Random.Range(GameConstants.RandomSnapValue / 4, GameConstants.RandomSnapValue * 3 / 4);
                //else
                //	newDepth = GameConstants.RandomSnapValue - newDepth;
                newEarth = UnityEngine.Random.Range(0, 2 * numEarthTypes);

                if (i < strataDivision)
                {
                    strataEarthType = EarthType.SOFT_MUD;
                }
                else if (i < 2 * strataDivision)
                {
                    strataEarthType = EarthType.HARD_MUD;
                }
                else
                {
                    strataEarthType = EarthType.GRAVEL;
                }
                newDepth        = 10;
                mEarthLevels[i] = new Level(strataEarthType, newDepth, backgroundContainer, prevTransform);
                prevTransform   = mEarthLevels[i].quad.transform;
            }
            mEarthLevels[i] = new Level(EarthType.CORE, 10, backgroundContainer, prevTransform);
            mEarthLevels[mEarthLevels.Length - 1].isLast = true;
            mEarthLevels[mEarthLevels.Length - 1].quad.transform.position += Vector3.back * 2;

            makeCore(prevTransform);

            trailSprites = new List <GameObject>();

            isInEarth = false;
        }
コード例 #7
0
        /*
         * public override void OnDoubleClick(Mobile from)
         * {
         *  if (from is PlayerMobile)
         *  {
         *      if (HasEarth)
         *      {
         *          if (HasPlant)
         *          {
         *              from.SendGump(new BotaniqueGump((PlayerMobile)from, this));
         *          }
         *          else
         *          {
         *              from.SendMessage("Choisissez de la graine à mettre dans votre bol.");
         *              from.BeginTarget(1, false, TargetFlags.None, new TargetCallback(this.ChooseSeed_OnTarget));
         *          }
         *      }
         *      else
         *      {
         *          from.SendMessage("Choisissez de la terre à mettre dans votre bol.");
         *          from.BeginTarget(1, false, TargetFlags.None, new TargetCallback(this.ChooseEarth_OnTarget));
         *      }
         *  }
         * }*/

        public void ChooseEarth_OnTarget(Mobile from, object targeted)
        {
            if (Deleted || !from.CheckAlive())
            {
                return;
            }

            if (targeted is Earth)
            {
                m_EarthType = ((Earth)targeted).EarthType;
            }
            else
            {
                from.SendMessage("Vous devez choisir de la terre.");
            }
        }
コード例 #8
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 1:
            {
                m_EarthType = (EarthType)reader.ReadInt();
                m_Plant     = (BasePlant)reader.ReadItem();
                goto case 0;
            }

            case 0:
            {
                break;
            }
            }
        }
コード例 #9
0
 public EarthSettings()
 {
     Type     = EarthType.Earth;
     Material = null;
 }
コード例 #10
0
 public virtual void Empty()
 {
     m_EarthType = EarthType.None;
 }
コード例 #11
0
ファイル: BotaniqueSystem.cs プロジェクト: jicomub/Temrael
 public static string GetEarthName(EarthType type)
 {
     return(GetEarthName(type, true));
 }