TrewSx's Profile User Rating: -----

Reputation: 2 Apprentice
Group:
Active Members
Active Posts:
50 (0.05 per day)
Joined:
07-June 12
Profile Views:
2,588
Last Active:
User is offline Jun 24 2013 11:04 AM
Currently:
Offline

Previous Fields

Dream Kudos:
0
Icon   TrewSx has not set their status

Posts I've Made

  1. In Topic: TextAsset inside the Array - UnityScript/JavaScript

    Posted 30 Mar 2013

    i also changed my var temp

    var temp : int = Random.Range(0,10) + weaponsList.Count;

    so this will give me random values between 0 and 10 and not only 0 as before

    Does not fix anything tho
  2. In Topic: TextAsset inside the Array - UnityScript/JavaScript

    Posted 30 Mar 2013

    Trying to use an integer seems to be the problem, but how do i get a random number of items from my TextAsset ?


    I have 10 items there Axe +1, +2 etc
  3. In Topic: TextAsset inside the Array - UnityScript/JavaScript

    Posted 30 Mar 2013

    my error message

    The best overload for the method 'System.Collections.Generic.List.<UnityEngine.TextAsset>.Add(UnityEngine.TextAsset)' is not compatible with the argument list '(int)'.
  4. In Topic: TextAsset inside the Array - UnityScript/JavaScript

    Posted 30 Mar 2013

    i have made some modifications
    import System.Collections.Generic;
     
    public var weaponsList : List.<TextAsset> = new List.<TextAsset>();        
     
    function  InitialiseArray() {
     
        weaponsList = new List.<TextAsset>();
     
        CreateRandomItemsFromArray();
    }          
     
    private function CreateRandomItemsFromArray() {
     
        var total : int = Mathf.Clamp(Random.value * 10, 4, 10);
     
           for(var _cnt : int = 0; _cnt < total; _cnt++) {
     
         var temp : int = Random.Range(0,weaponsList.Count);
     
            //weaponsList.Add(temp); //problem is here
     
            Debug.Log(_cnt + " -- " + weaponsList);
        }
    }
    
    

    it's all working except i dont know how to store my newly created Random range of my items.
  5. In Topic: OnGUI and Event.current

    Posted 28 Mar 2013

    Solved

    #pragma strict
    
    
    var curHp 	 : float = 100.0;
    var maxHp	 : float = 100.0;
    
    var curSp	 : float = 50.0;
    var maxSp 	 : float = 50.0; 
    
    
    var hpBarTexture : Texture2D;
    var spBarTexture : Texture2D;
    
    var hpBarlength  : float;
    var percentOfHp  : float;
    
    
    var spBarLength : float;
    var percentOfSp : float;
    
    
    private var _hpSpWindowRect				:    Rect = new Rect(10,Screen.height / 2 + 150,190,70);
    private var _hpSpWindowID				:    int   = 1;
    
    
    function OnGUI () {
    	var e = Event.current;
    	
    	if (e.type == EventType.KeyDown && e.keyCode == KeyCode.H) 
    	ReduceHelathAndMana();
    	
    	_hpSpWindowRect = GUI.Window(_hpSpWindowID, _hpSpWindowRect, HpSpWindow, "Health points  /  Spell points");
    
    }
    
    
    function ReduceHelathAndMana() {
    	
    	//curHp -= 10*Time.deltaTime;	
    	curHp -= 10;
    	percentOfHp = curHp/maxHp;
    	hpBarlength = percentOfHp*100;
    	
    	//curSp -= 10*Time.deltaTime;
    	curSp -= 10;
    	percentOfSp = curSp/maxSp;
    	spBarLength = percentOfSp*100;
    }
    
    function HpSpWindow (_hpSpWindowID) {
    	
    		
    	if (curHp > 0) 
    	{
    		GUI.DrawTexture (new Rect (20,20,hpBarlength,20),hpBarTexture);
    	}
    	
    	if (curSp > 0) 
    	{
    		GUI.DrawTexture (new Rect (20,40,spBarLength,20),spBarTexture);
    	}	
    	GUI.DragWindow();
    	
    }
    

My Information

Member Title:
D.I.C Head
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:

Contact Information

E-mail:
Click here to e-mail me

Friends

TrewSx hasn't added any friends yet.

Comments

TrewSx has no profile comments yet. Why not say hello?