Ejemplo n.º 1
0
    public Sprite getSprite(elementType type)
    {
        switch (type)
        {
        case elementType.fire:
            return(fire);

        case elementType.water:
            return(water);

        case elementType.earth:
            return(earth);

        case elementType.steam:
            return(steam);

        case elementType.mud:
            return(mud);

        case elementType.meteor:
            return(meteor);

        default:
            return(null);
        }
    }
Ejemplo n.º 2
0
	//Move an element (visual only) from spawnpoint to hand
	void ElementSpawnStart (elementType element, int handNumber){
		switch (element) { 
		case elementType.Fire:
			GameObject clone1 = (GameObject)Instantiate (fireVisual, fireSpawn.position, Quaternion.identity);
			clone1.GetComponent<ElementSpawnVisual>().element = element; 
			clone1.GetComponent<ElementSpawnVisual>().handNumber = handNumber;
			GameManager.instance.audioManager.OneShot(elementType.Fire);
			break;
		case elementType.Air:
			GameObject clone2 = (GameObject)Instantiate (airVisual, airSpawn.position, Quaternion.identity);
			clone2.GetComponent<ElementSpawnVisual>().element = element; 
			clone2.GetComponent<ElementSpawnVisual>().handNumber = handNumber; 
			break;
		case elementType.Water:
			GameObject clone3 = (GameObject)Instantiate (waterVisual, waterSpawn.position, Quaternion.identity);
			clone3.GetComponent<ElementSpawnVisual>().element = element; 
			clone3.GetComponent<ElementSpawnVisual>().handNumber = handNumber; 
			break;
		case elementType.Earth:
			GameObject clone4 = (GameObject)Instantiate (earthVisual, earthSpawn.position, Quaternion.identity);
			clone4.GetComponent<ElementSpawnVisual>().element = element; 
			clone4.GetComponent<ElementSpawnVisual>().handNumber = handNumber; 
			break;
		}


	}
Ejemplo n.º 3
0
    void ShiftElementRight()
    {
        switch (elementIndex)
        {
//            case elementType.wind:
//                elementIndex = elementType.fire;
//				forwardWindParticles.GetComponent<ParticleSystem>().Stop();
//				backwardWindParticles.GetComponent<ParticleSystem>().Stop();
//				windCollider.GetComponent<WindProperties>().SetBlowing(false);
//				windBlowing = false;
//                break;

        case elementType.water:
            spraywaterParticles.GetComponent <ParticleSystem>().Stop();
            rainSound.Stop();
            spraywaterParticles.GetComponent <RainProperties>().SetRaining(false);
            elementIndex   = elementType.wind;
            absorbingWater = false;
            shootingWater  = false;
            break;

//            case elementType.fire:
//                elementIndex = elementType.water;
//                break;
        }
    }
Ejemplo n.º 4
0
	//Create a spell with elements from player when player demands it
	public SpellManager CreateSpellNetworked(elementType t, Vector3 position){
		Debug.Log ("Count CreateSpellNetworked");
		SpellManager spell = new SpellManager();
		GameObject g;

		spell.id = spellId;
		spellId++;
//		shield.id = shieldId;
//		shieldId++;
		PhotonView currentPhotonView;
		SpellObserver spellObserver;

		if (spellBook.TryGetValue (t.ToString () + "Spell", out g)) {

			currentPhotonView = g.GetComponent<PhotonView>();
			
			if(currentPhotonView == null){
				currentPhotonView = g.AddComponent<PhotonView>();
			}
			

			spellObserver = g.GetComponent<SpellObserver>();
			if (spellObserver == null){
				spellObserver = g.AddComponent<SpellObserver>();
			}
			
			//				Debug.Log("currentPhotonView Count: " + currentPhotonView.ObservedComponents.Count);
			currentPhotonView.ObservedComponents.Clear();
//			currentPhotonView.ObservedComponents.Add();

			if(currentPhotonView.ObservedComponents!=null && currentPhotonView.ObservedComponents.Count==0)
			{
				currentPhotonView.ObservedComponents.Add(spellObserver);
//				currentPhotonView.ObservedComponents.Add(this.transform);
				//					currentPhotonView.ObservedComponents[0] = shieldObserver;
				//					currentPhotonView.ObservedComponents.
			}
			
			// Instantiate on network (call current element shield from within shield folder)
			spell.instance = (GameObject) PhotonNetwork.Instantiate(
				"Spells/"+g.name, inFrontOfPlayer.position, inFrontOfPlayer.rotation,0);
			Debug.Log("spellspawner:instantiate " + g.name);

//			spell.instance.

//			spell.instance = (GameObject)Instantiate (g, inFrontOfPlayer.position, transform.rotation);
			spell.Setup ();
			spell.spellCollision.elementType = t;
		} else {
			spell = null;
		}
		
		return spell; 
	}
Ejemplo n.º 5
0
	//Create a spell with elements from player when player demands it
	public SpellManager CreateSpell(elementType t, Vector3 position){
		SpellManager spell = new SpellManager();
		GameObject g;
		if (spellBook.TryGetValue (t.ToString () + "Spell", out g)) {
			//spell.instance = (GameObject)Instantiate (g, position, transform.rotation);
			spell.instance = (GameObject)Instantiate (g, inFrontOfPlayer.position, transform.rotation);
			spell.Setup ();
			spell.spellCollision.elementType = t;
		} else {
			spell = null;
		}

		return spell; 
	}
Ejemplo n.º 6
0
 public ItemList(string name, string id, string desc, float power, float def, float speed, float ls, float itemHPIncre, elementType etype, ItemType type, Sprite sprite)
 {
     ItemName        = name;
     itemID          = id;
     itemIcon        = sprite;
     itemDesc        = desc;
     itemPower       = power;
     itemDefense     = def;
     itemAttackSpeed = speed;
     itemLifeSteal   = ls;
     elementtype     = etype;
     itemType        = type;
     itemHPInCrease  = itemHPIncre;
     if (itemType == ItemType.Gear)
     {
     }
 }
Ejemplo n.º 7
0
	//Create an element
	public ElementManager GetElementOfType(elementType t, int handNumber){
		ElementManager element = null;
		GameObject g;
		HandModel[] hands = GameManager.instance.movementManager.handController.GetAllPhysicsHands();

		if (elementBook.TryGetValue (t.ToString (), out g)) {
			element = new ElementManager ();
			element.instance = (GameObject)Instantiate (g, hands[handNumber].GetPalmPosition(), transform.rotation);
			element.elementType = t;
			element.Setup ();
			element.elementMovement.handNumber = handNumber;
		} else {
			print ("Could not find element: " + t.ToString());
		}

		return element;
	}
Ejemplo n.º 8
0
    public bool isPaused = false;     //used when game is paused

    // Use this for initialization
    void Start()
    {
        scene = SceneManager.GetActiveScene();

        //playGrowingSound = false;
        try
        {
            L = GameObject.FindGameObjectWithTag("fire base1").transform.gameObject.GetComponent <DoorTorchLight>();
        }
        catch (NullReferenceException e)
        {
            Debug.Log("No fire base found");
        }
        elementIndex = elementType.wind;
        GUICanvas.GetComponent <GUIControl>().SelectElement((int)elementIndex);

        windBlowing   = false;
        windDirection = Vector3.zero;
        waterStored   = 0;
        model         = gameObject.GetComponent <actorcontroller> ().model;
        anim          = model.GetComponent <Animator> ();

        pushableObjects = GameObject.FindGameObjectsWithTag("Pushable");
        //vineBridge = GameObject.FindGameObjectWithTag("original vine");

        headObject = transform.Find("CameraHandle");
        if (headObject == null)
        {
            headObject = transform.Find("CameraHandle2").Find("CameraHandle");
        }
        //Debug.Log(headObject);
        windCollider = headObject.Find("WindCollision");
        //Debug.Log(windCollider);

        forwardWindParticles  = headObject.Find("forward wind");
        backwardWindParticles = headObject.Find("backwards wind");
        backWindPos           = headObject.Find("backwards wind position");


        groundDust = new List <ParticleSystem>();

        waterIn = null;
    }
Ejemplo n.º 9
0
	string CreateString (elementType Element, bool isSpell){
		string e = Element.ToString ();
		if (e.Contains ("Fire")) {
			e = e.Replace ("Fire", "F");
		}
		if (e.Contains ("Air")) {
			e = e.Replace ("Air", "A"); 
		}
		if (e.Contains ("Water")) {
			e = e.Replace ("Water", "W");
		}
		if (e.Contains ("Earth")) {
			e = e.Replace ("Earth","E");
		}
		switch (Element) {
		case elementType.Air:
			e = e.Insert(1, "0");
			break;
		case elementType.Earth:
			e = e.Insert(1, "0");
			break;
		case elementType.Fire:
			e = e.Insert(1, "0");
			break;
		case elementType.Water:
			e = e.Insert(1, "0");
			break;
		default:
			break;
		}
		if (isSpell) {
			e = e.Insert(2,"_M");
		} else {
			e = e.Insert(2,"_S");
		}
		
		return e;
	}
Ejemplo n.º 10
0
        // not used at the moment
        private void readXmlSchemaSequence(XmlSchemaObject item, elementType type)
        {
            XmlSchemaSequence sequence = item as XmlSchemaSequence;

            if(sequence != null)
            {
                foreach(XmlSchemaObject obj in sequence.Items)
                {
                    if(obj is XmlSchemaElement)
                        readXmlSchemaElement(obj, type);
                }
            }
        }
Ejemplo n.º 11
0
 public Mud() : base()
 {
     isStrong = new elementType[] { elementType.steam };
     type     = elementType.mud;
 }
Ejemplo n.º 12
0
	public void OneShot(elementType element)
	{
//		FMOD_StudioSystem.instance.PlayOneShot("snapshot:/Spells/Fire", transform.position);
	}
Ejemplo n.º 13
0
        // not used at the moment
        private void readXmlSchemaElement(XmlSchemaObject item, elementType type)
        {
            XmlSchemaElement element = item as XmlSchemaElement;

            if(element != null && element.Name != String.Empty)
            {
            }
        }
Ejemplo n.º 14
0
 public Steam() : base()
 {
     isStrong = new elementType[] { elementType.meteor };
     type     = elementType.steam;
 }
Ejemplo n.º 15
0
				: super(elementType.Library, TypeKind.Array) {
			this.elementType = elementType;
		}
Ejemplo n.º 16
0
 public ParsedElement(string Data, elementType ElementType)
 {
     this.Data        = Data;
     this.ElementType = ElementType;
 }
Ejemplo n.º 17
0
	//Add summoned element to element pool
	public void AddElementToPool(elementType t, int handNumber)
	{
		ElementManager element = ElementSpawner.instance.GetElementOfType (t, handNumber);
		elementPool.Add (element);

		HandModel[] hands = GameManager.instance.movementManager.handController.GetAllPhysicsHands();

		if (hands[handNumber].GetLeapHand().IsLeft) {
			leftElement = element;
		} else if (hands[handNumber].GetLeapHand().IsRight) {
			rightElement = element;
		}
	}
Ejemplo n.º 18
0
        /// <summary>
        /// Extract CSS tag id (e.g. hl em {})
        /// </summary>       
        public static String ExtractNextElement(ref string input, ref elementType element)
        {
            input = input.Trim();
               if (input == "") { return ""; }
               string retVal = "";

               elementType e = charType(input[0]);
               element = e;
               char nextChar = input[0];

               while (input != "")
               {
               retVal += nextChar;
               input = input.Substring(1);
               string temp = input.Trim();
               if ((temp != "") && (charType(temp[0]) == elementType.eSymbol))
               {
                   input = temp.Substring(1);
                   return retVal + temp[0];
               }
               switch (e)
               {
                   case elementType.eSymbol:
                       return retVal;
                   case elementType.eDash:
                       retVal += ExtractNextElement(ref input, ref element);
                       break;
                   case elementType.eStyle:
                       retVal += ExtractNextElement(ref input, ref element);
                       break;
                   case elementType.eClass:
                       retVal += ExtractNextElement(ref input, ref element);
                       break;
                   case elementType.eId:
                       retVal += ExtractNextElement(ref input, ref element);
                       break;
               }

               if (input == "") { return retVal; }
               else
               {
                   e = charType(input[0]);
                   nextChar = input[0];
                   if (e == elementType.eSpace) { return retVal; }
               }

               }
               return retVal;
        }
Ejemplo n.º 19
0
 public Fire() : base()
 {
     isStrong = new elementType[] { elementType.earth };
     type     = elementType.fire;
 }
Ejemplo n.º 20
0
 public Meteor() : base()
 {
     isStrong = new elementType[] { elementType.mud };
     type     = elementType.meteor;
 }
Ejemplo n.º 21
0
 public Earth() : base()
 {
     isStrong = new elementType[] { elementType.water };
     type     = elementType.earth;
 }
Ejemplo n.º 22
0
 public void SetRandomColor()
 {
     type = (elementType)Random.Range(0, 6);
     SetColor();
 }
Ejemplo n.º 23
0
 public Water() : base()
 {
     isStrong = new elementType[] { elementType.fire };
     type     = elementType.water;
 }
Ejemplo n.º 24
0
    private void addElement(elementType e, GeoLibPoint p)
    {
        int x;
        int y;

        switch (e)
        {
        case elementType.boxElement:
            x = modal.geometry_x;
            y = modal.geometry_y;
            modal.geometry_x += p.X;
            modal.geometry_y += p.Y;
            addBox();
            modal.geometry_x = x;
            modal.geometry_y = y;
            break;

        case elementType.polygonElement:
            x = modal.geometry_x;
            y = modal.geometry_y;
            modal.geometry_x += p.X;
            modal.geometry_y += p.Y;
            addPolygon();
            modal.geometry_x = x;
            modal.geometry_y = y;
            break;

        case elementType.pathElement:
            x = modal.geometry_x;
            y = modal.geometry_y;
            modal.geometry_x += p.X;
            modal.geometry_y += p.Y;
            addPath();
            modal.geometry_x = x;
            modal.geometry_y = y;
            break;

        case elementType.cellrefElement:
            x = modal.placement_x;
            y = modal.placement_y;
            modal.placement_x += p.X;
            modal.placement_y += p.Y;
            addCellref();
            modal.placement_x = x;
            modal.placement_y = y;
            break;

        case elementType.textElement:
            x             = modal.text_x;
            y             = modal.text_y;
            modal.text_x += p.X;
            modal.text_y += p.Y;
            addText();
            modal.text_x = x;
            modal.text_y = y;
            break;

        case elementType.circleElement:
            x             = modal.text_x;
            y             = modal.text_y;
            modal.text_x += p.X;
            modal.text_y += p.Y;
            addCircle();
            modal.text_x = x;
            modal.text_y = y;
            break;

        case elementType.trapezoidElement:
            x             = modal.text_x;
            y             = modal.text_y;
            modal.text_x += p.X;
            modal.text_y += p.Y;
            addTrapezoid();
            modal.text_x = x;
            modal.text_y = y;
            break;

        case elementType.ctrapezoidElement:
            x             = modal.text_x;
            y             = modal.text_y;
            modal.text_x += p.X;
            modal.text_y += p.Y;
            addCtrapezoid();
            modal.text_x = x;
            modal.text_y = y;
            break;
        }
    }