اذهب إلى المحتوى

said said-2

الأعضاء
  • المساهمات

    36
  • تاريخ الانضمام

  • تاريخ آخر زيارة

أجوبة بواسطة said said-2

  1. السلام عليكم

    عندي مشكلة يا اخوان جننتني في ويندوز 10 ولا اعرف كيف احلها وهي مع مدير الملفات File Explorer دائما ينهار ولابسط الامور وافقد كل ماكنت اقوم به في التيبوبات الاخرى فهل هناك حل له>ه المشكلة.

    وشكرا

  2. شكرا لك اخي على المساعدة لكن المشكل مازال قائم

    Assets/Scripts/LevelManager.cs(42,18): error CS1061: Type `ResetOnRespawn[]' does not contain a definition for `add' and no extension method `add' of type `ResetOnRespawn[]' could be found. Are you missing an assembly reference?

     

     

    ويتم التسطير على add في فزيال ستوديو

  3. السلام عليكم 

    وانا اتتبع احد الدروس الانجليزية على الانترنت منذ اسبوع لم اجد حتى مشكلة الا ان ظهرت مشكلة اليوم ورغم المحاولات لحلها لم استطع و ارجو ان اجد الحل عندكم

     

    رسالة الخطأ في يونتي 

     

    Assets/Scripts/LevelManager.cs(41,20): error CS0029: Cannot implicitly convert type `ResetOnRespawn' to `ResetOnRespawn[]'

     

     

    يتم تسطير على الخطأ FindObjectOfType <ResetOnRespawn> ();

     

    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    using UnityEngine.UI;
    
    public class LevelManager : MonoBehaviour {
    
    	public float waitToRespawn;
    	public PlayerController thePlayer;
    
    	public GameObject deathSplosion;
    
    	public int coinCount;
    
    	public Text CoinText;
    
    	public Image heart1;
    	public Image heart2;
    	public Image heart3;
    
    	public Sprite heartFull;
    	public Sprite heartHalf;
    	public Sprite heartEmpty;
    
    	public int maxHealth;
    	public int healthCount;
    
    	private bool respawning;
    
    	public ResetOnRespawn[] objectsToReset;
    
    	// Use this for initialization
    	void Start () {
    
    		thePlayer = FindObjectOfType<PlayerController>();
    
    		CoinText.text = "Coins: " + coinCount;
    
    		healthCount = maxHealth;
    
    		objectsToReset = FindObjectOfType <ResetOnRespawn> ();
    	}
    	
    	// Update is called once per frame
    	void Update () {
    		if(healthCount <= 0 && !respawning)
    		{
    			Respawn();
    			respawning = true;
    		}
    	}
    
    	public void Respawn()
    	{
    		StartCoroutine("RespawnCo");
    	}
    
    	public IEnumerator RespawnCo()
    	{
    		thePlayer.gameObject.SetActive(false);
    
    		Instantiate(deathSplosion, thePlayer.transform.position, thePlayer.transform.rotation);
    
    		yield return new WaitForSeconds(waitToRespawn);
    
    		healthCount = maxHealth;
    		respawning = false;
    		UpdateHeartMeter();
    
    		thePlayer.transform.position = thePlayer.respawnPosition;
    		thePlayer.gameObject.SetActive(true);
    	}
    
    	public void AddCoins(int CoinsToAdd)
    	{
    		coinCount += CoinsToAdd;
    
    		CoinText.text = "Coins: " + coinCount;
    	}
    
    	public void HurtPlayer(int damageToTake)
    	{
    		healthCount -= damageToTake;
    		UpdateHeartMeter();
    	}
    
    	public void UpdateHeartMeter()
    	{
    		switch(healthCount)
    		{
    			case 6:
    				heart1.sprite = heartFull;
    				heart2.sprite = heartFull;
    				heart3.sprite = heartFull;
    				return;
    
    			case 5:
    				heart1.sprite = heartFull;
    				heart2.sprite = heartFull;
    				heart3.sprite = heartHalf;
    				return;
    
    			case 4:
    				heart1.sprite = heartFull;
    				heart2.sprite = heartFull;
    				heart3.sprite = heartEmpty;
    				return;
    
    			case 3:
    				heart1.sprite = heartFull;
    				heart2.sprite = heartHalf;
    				heart3.sprite = heartEmpty;
    				return;
    
    			case 2:
    				heart1.sprite = heartFull;
    				heart2.sprite = heartEmpty;
    				heart3.sprite = heartEmpty;
    				return;
    
    			case 1:
    				heart1.sprite = heartHalf;
    				heart2.sprite = heartEmpty;
    				heart3.sprite = heartEmpty;
    				return;
    
    			case 0:
    				heart1.sprite = heartEmpty;
    				heart2.sprite = heartEmpty;
    				heart3.sprite = heartEmpty;
    				return;
    
    			default:
    				heart1.sprite = heartEmpty;
    				heart2.sprite = heartEmpty;
    				heart3.sprite = heartEmpty;
    				return;
    
    		}
    	}
    }

     

     

     

×
×
  • أضف...