当前位置: 首页>>代码示例>>C#>>正文


C# GameObject.ToString方法代码示例

本文整理汇总了C#中GameObject.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# GameObject.ToString方法的具体用法?C# GameObject.ToString怎么用?C# GameObject.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GameObject的用法示例。


在下文中一共展示了GameObject.ToString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SetDestroyedCube

 public int SetDestroyedCube(GameObject toDestroyingCube)
 {
     switch (toDestroyingCube.ToString())
     {
         case "DirtCube(Clone) (UnityEngine.GameObject)":
             destroyedItem = 0;
             break;
         case "StoneCube(Clone) (UnityEngine.GameObject)":
             destroyedItem = 1;
             break;
         case "Wooden_PlanksCube(Clone) (UnityEngine.GameObject)":
             destroyedItem = 2;
             break;
         case "Copple_stone(Clone) (UnityEngine.GameObject)":
             destroyedItem = 3;
             break;
         case "Gravel(Clone) (UnityEngine.GameObject)":
             destroyedItem = 4;
             break;
         case "Sand(Clone) (UnityEngine.GameObject)":
             destroyedItem = 5;
             break;
         case "Bedrock(Clone) (UnityEngine.GameObject)":
             destroyedItem = 6;
             break;
         case "Obsidian(Clone) (UnityEngine.GameObject)":
             destroyedItem = 7;
             break;
         case "Brick(Clone) (UnityEngine.GameObject)":
             destroyedItem = 8;
             break;
     }
     //print (destroyedItem);
     return destroyedItem;
 }
开发者ID:CookingCookie,项目名称:BlockDefense,代码行数:35,代码来源:DestroyedCube.cs

示例2: Check

 void Check(GameObject obj)
 {
     //check gameObject's number
     if(obj == objectList[count] && !bIsSolved)
     {
         Debug.Log ("Match! Obj: " + obj.ToString() + " Count: " + count + " ObjList: " + objectList[count].ToString());
         Debug.Log ("Count List: " + objectList.Count);
         if(count == objectList.Count - 1)
         {
             Open ();
             bIsSolved = true;
             this.gameObject.renderer.material.color = Color.green;
         }
         count++;
     }
     else
     {
         count = 0;
         foreach(GameObject item in objectList)
         {
             objectList[count].SendMessage("Reset");
             count++;
         }
         count = 0;
         this.renderer.material.color = Color.red;
         Debug.Log ("Reset! Count: " + count);
     }
 }
开发者ID:ChrisC64,项目名称:SeniorProject,代码行数:28,代码来源:OrderSwitchObject.cs

示例3: Start

 // Use this for initialization
 void Start()
 {
     gl = (GameLogic)FindObjectOfType(typeof(GameLogic));
     ft = (FractalTexture)FindObjectOfType(typeof(FractalTexture));
     pl = (Player)FindObjectOfType(typeof(Player));
     whiteNoise = GameObject.Find("WhiteNoise");
     Debug.Log("White Noise: " + whiteNoise.ToString());
 }
开发者ID:holmgard,项目名称:SimpleStressGame,代码行数:9,代码来源:GameConfigurator.cs

示例4: Start

	void Start() {
		currentScene = Object.Instantiate (scenePrefabs[0]);
		metricController = GetComponent<MetricController>();
		totalTimeSpentDrinkingCoffee = 0.0f;
		Debug.Log (currentScene.ToString ());
		fader = c.GetComponent<Fade> ();
		IsGameOver = false;
		fader.FadeIn ();
	}
开发者ID:JimSRush,项目名称:Coffee,代码行数:9,代码来源:GameController.cs

示例5: setDrone

 public void setDrone(int role, GameObject obj)
 {
     switch(role)
     {
         case 0: droneLeft = obj; break;
         case 1: droneRight = obj; break;
         case 2: droneBack = obj; break;
         default: Debug.Log("Error : unknown role for drone "+obj.ToString()); break;
     }
 }
开发者ID:JoshuaSenouf,项目名称:VI50_Drone,代码行数:10,代码来源:BoatControllerIA.cs

示例6: GetCache

 static GameObject GetCache(GameObject G)
 {
     if (G == null)
         throw new System.Exception("Constraint Spawner null object requested");
     if (Cache == null) Cache = new Dictionary<GameObject, GameObject>();
     if (!Cache.ContainsKey(G))
         Cache[G] = (GameObject)Instantiate(G, new Vector3(0, -100, 0), new Quaternion());
     if (!Cache.ContainsKey(G))
         throw new System.Exception(G.ToString() + " Constraint spawner could not spawn blueprint");
     return Cache[G];
 }
开发者ID:HatiEth,项目名称:GGJ2016,代码行数:11,代码来源:ConstraintSpawner.cs

示例7: LoadMagePrefs

    void LoadMagePrefs()
    {
        selectedCharacter = Mage;
        Debug.Log(selectedCharacter.ToString());

        if (GameObject.Find("Picture"))
        {
            ImageOff.enabled = true;
            GameObject SelectImage = GameObject.Find("CharacterPicture");
            Image MagePicture = SelectImage.GetComponent<Image>();
            MagePicture.sprite = MagePic;
        }

        if (GameObject.Find("Atributos"))
        {
            //Procura os gameobjects
            GameObject WriteHP = GameObject.Find("HPText");
            GameObject WriteMP = GameObject.Find("MPText");
            GameObject WriteSTR = GameObject.Find("STRText");
            GameObject WriteVIT = GameObject.Find("VITText");
            GameObject WriteDEX = GameObject.Find("DEXText");
            GameObject WriteINT = GameObject.Find("INTText");

            //Escreve nas labels.
            Text textHP = WriteHP.GetComponent<Text>();
            textHP.text = "100".ToString();
            Text textMP = WriteMP.GetComponent<Text>();
            textMP.text = "150".ToString();
            Text textSTR = WriteSTR.GetComponent<Text>();
            textSTR.text = "7 *1.8".ToString();
            Text textVIT = WriteVIT.GetComponent<Text>();
            textVIT.text = "5 *1.7".ToString();
            Text textDEX = WriteDEX.GetComponent<Text>();
            textDEX.text = "5 * 1.7".ToString();
            Text textINT = WriteINT.GetComponent<Text>();
            textINT.text = "12 *1.5".ToString();

        }

        if (GameObject.Find("Skills"))
        {
            GameObject WriteSkill1 = GameObject.Find("Skill1Text");
            GameObject WriteSkill2 = GameObject.Find("Skill2Text");
            GameObject WriteSkill3 = GameObject.Find("Skill3Text");

            Text textSkill1 = WriteSkill1.GetComponent<Text>();
            textSkill1.text = "Fireball".ToString();
            Text textSkill2 = WriteSkill2.GetComponent<Text>();
            textSkill2.text = "Throw Stone".ToString();
            Text textSkill3 = WriteSkill3.GetComponent<Text>();
            textSkill3.text = "Water Blast".ToString();
        }
    }
开发者ID:rodolfowtf,项目名称:RPG_Project,代码行数:53,代码来源:Settings.cs

示例8: Generate

 void Generate()
 {
     if(numLeft > 0) {
         current = GameObject.Instantiate(blockProto, Vector3.zero, Quaternion.identity) as GameObject;
         Debug.Log (current.ToString());
         Debug.Log (current.GetType ().ToString());
         current.transform.SetParent (gameObject.transform);
         current.transform.localPosition = new Vector3(0.6f, 0, 0);
         current.transform.localScale = new Vector3(1, 1, 1);
         current.GetComponent<ProgBlock>().onPickup += OnPickup;
     }
 }
开发者ID:IanPudney,项目名称:Terminus,代码行数:12,代码来源:BlockBank.cs

示例9: Pool

 public Pool(GameObject obj, GameObject parent, int size)
 {
     index = 0;
     GameObject container = new GameObject("Pool"+obj.ToString());
     container.transform.SetParent(parent.transform);
     for (int i = 0; i < size; i++)
     {
         GameObject instance = GameObject.Instantiate(obj);
         instance.transform.parent = container.transform;
         instance.SetActive(false);
         objects.Add(instance);
     }
 }
开发者ID:Mythique,项目名称:M2-Unity-Tower-Defense,代码行数:13,代码来源:Pool.cs

示例10: Assign

 public override int Assign(GameObject entity)
 {
     if (entityMap [0] == null) {
         FormationLeader = entity;
         entityMap [0] = entity;
         return 0;
     } else if (entityMap [1] == null) {
         entityMap [1] = entity;
         return 1;
     } else {
         throw (new UnityException ("Tried to Assign entity " + entity.ToString () + " to a full formation."));
     }
 }
开发者ID:byrontheii,项目名称:WOMBATXXI,代码行数:13,代码来源:RangerFileFormation.cs

示例11: onSelection

    public void onSelection(GameObject selected)
    {
        Debug.Log (selected.ToString());
        if (buttons != null) {
            foreach(Button b in buttons){
                b.image.sprite = offSprite;
                //Debug.Log(b.ToString);
            }
            Image i = selected.GetComponent<Image>();
            i.sprite = onSprite;

        }
    }
开发者ID:ZachOfAllTradez,项目名称:CS3350_CMC,代码行数:13,代码来源:selectSettings.cs

示例12: EntityIs

        /// <summary>
        /// Checks to see if an entity is tagged with a specified tag
        /// </summary>
        /// <param name="Entity"></param>
        /// <param name="Tag"></param>
        /// <returns></returns>
        public static bool EntityIs(GameObject Entity,Tag Tag)
        {
            EntityTag _Tag = Entity.GetComponent<EntityTag>();

            if (!_Tag)
            {
                Debug.Log("Game Object does not contain an EntityTag: " + Entity.ToString());
                return false;
            }
            else
            {
                return _Tag.Is(Tag);
            }
        }
开发者ID:IsaacOfModels,项目名称:Installation01,代码行数:20,代码来源:EntityTag.cs

示例13: errors

    Color defaultGUI = Color.white; // set to white to avoid errors (Color is non-nullable)

    #endregion Fields

    #region Methods

    // add an item to the inventory
    public void AddItem(GroundItem i)
    {
        // only add items if there's room in the inventory
        if (!IsFull())
        {
            // create a new game object and give it a held item script
            GameObject toAdd = new GameObject(i.name);
            toAdd.AddComponent<HeldItem>();
            toAdd.GetComponent<HeldItem>().Initialize(i.GetComponent<SpriteRenderer>().sprite, i.cooldown);
            toAdd.GetComponent<HeldItem>().projectile = i.projectile;

            // add the new item to the inventory
            inv[currentItems] = toAdd;
            currentItems++;
            Destroy(i.gameObject);
            Debug.Log("Item \"" + toAdd.ToString() + "\" added to inventory");
        }
    }
开发者ID:problemsleuth,项目名称:SpaceShooter,代码行数:25,代码来源:Inventory.cs

示例14: cameraMove_Lerp

    //void cameraTrack_Lerp(GameObject player)
    //{
    //    //Vector3 playerPos =
    //    //mainCamera.transform.position = new Vector3(mainCamera.transform.position.x, player.transform.position.y, mainCamera.transform.position.z);
    //    Debug.Log("cameraTrack_Lerp called");
    //    Debug.Log("player available while rotation:     " + player.ToString());
    //    float wantedHeight = player.transform.position.y;
    //    Vector3 targetPos = new Vector3(mainCamera.transform.position.x, wantedHeight, mainCamera.transform.position.z);
    //    mainCamera.transform.position = Vector3.Lerp(mainCamera.transform.position, targetPos, heightDamping * Time.deltaTime);
    //}
    private void cameraMove_Lerp(GameObject player)
    {
        if(_isAdjustingCamera == true)
        {
            //_isAdjustingCamera = true;
            //mainCamera.transform.position = new Vector3(mainCamera.transform.position.x, player.transform.position.y, mainCamera.transform.position.z);
            Debug.Log("cameraMove_Lerp called");
            Debug.Log("player available while rotation:     " + player.ToString());

            float wantedHeight = player.transform.position.y;
            float currentHeight = mainCamera.transform.position.y;

            //Vector3 targetPos = new Vector3(mainCamera.transform.position.x, wantedHeight, mainCamera.transform.position.z);
            Vector3 amount = new Vector3(0, wantedHeight - currentHeight, 0);
            Debug.Log("amount" + amount);
            //mainCamera.transform.position = Vector3.MoveTowards(mainCamera.transform.position, targetPos, heightDamping * Time.deltaTime);
            //iTween.MoveAdd(mainCamera, amount, timeAdjustingCamera);
            iTween.MoveAdd(mainCamera, iTween.Hash(iT.MoveAdd.time, timeAdjustingCamera, iT.MoveAdd.amount, amount, iT.MoveAdd.oncomplete, "onAdjustCameraComplete", iT.MoveAdd.oncompletetarget, gameObject));
        }
    }
开发者ID:AnisaLl,项目名称:UPx3-2-,代码行数:30,代码来源:cameraController_camera.cs

示例15: Act

    public override void Act(GameObject player, GameObject npc)
    {
        Debug.Log("FollowPath: ACT");
        Debug.Log("FollowPath: player - "+player.ToString()+". npc - "+npc.ToString());
        // Follow the path of waypoints
        // Find the direction of the current way point
        //Vector3 vel = npc.rigidbody.velocity;
        Vector3 vel = npc.GetComponent<Rigidbody>().velocity;
        Vector3 moveDir = waypoints[currentWayPoint].position - npc.transform.position;

        if (moveDir.magnitude < 1)
        {
            currentWayPoint++;
            Debug.Log("FollowPath: Incrementa WayPoint");
            if (currentWayPoint >= waypoints.Length)
            {
                currentWayPoint = 0;
            }
        }
        else
        {
            Debug.Log("FollowPath: SEGUINDO WayPoints");
            vel = moveDir.normalized * NPCControl.GetVelocityFactor();
            Debug.DrawRay(npc.transform.position,moveDir);

            // Rotate towards the waypoint
            npc.transform.rotation = Quaternion.Slerp(npc.transform.rotation,
                                                      Quaternion.LookRotation(moveDir),
                                                      2 * Time.deltaTime);

            //npc.transform.rotation.ToAngleAxis(180f,Vector3.up);
            //npc.transform.RotateAround(npc.transform.position,Vector3.up, 180.0f);
            //npc.transform.rotation = Quaternion.LookRotation(moveDir);
            npc.transform.eulerAngles = new Vector3(0, npc.transform.eulerAngles.y, 0);

        }

        // Apply the Velocity
        //npc.rigidbody.velocity = vel;
        npc.GetComponent<Rigidbody> ().velocity = vel;
    }
开发者ID:GraziKapps,项目名称:Labirinto,代码行数:41,代码来源:NPCControl.cs


注:本文中的GameObject.ToString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。