コード例 #1
0
	//*************************************************************//	
	void Start () 
	{
		_normalLightingMat = ( Material ) Resources.Load ( "LightningMat" );
		_previewLightingMat = ( Material ) Resources.Load ( "LightningPreviewMat" );
		
		_myIComponent = gameObject.GetComponent < IComponent > ();
		
		_myIComponent.position[0] = Mathf.RoundToInt ( transform.root.position.x );
		_myIComponent.position[1] = Mathf.RoundToInt ( transform.root.position.z + 0.5f );	
		
		_lightinigEmmiterPrefab = ( GameObject ) Resources.Load ( "LightningEmitter" );
		_lightinigEmmiterInstant01 = ( GameObject ) Instantiate ( _lightinigEmmiterPrefab, transform.root.position - Vector3.up * 0.5f, transform.rotation );
		_lightinigEmmiterInstant02 = ( GameObject ) Instantiate ( _lightinigEmmiterPrefab, transform.root.position - Vector3.up * 0.5f, transform.rotation );
		_lightinigEmmiterInstant03 = ( GameObject ) Instantiate ( _lightinigEmmiterPrefab, transform.root.position - Vector3.up * 0.5f, transform.rotation );
		_lightinigEmmiterInstant04 = ( GameObject ) Instantiate ( _lightinigEmmiterPrefab, transform.root.position - Vector3.up * 0.5f, transform.rotation );
		_lightinigEmmiterInstant01.name = "lightinigEmmiterInstant01";
		_lightinigEmmiterInstant02.name = "lightinigEmmiterInstant02";
		_lightinigEmmiterInstant03.name = "lightinigEmmiterInstant03";
		_lightinigEmmiterInstant04.name = "lightinigEmmiterInstant04";
		_lightinigEmmiterInstant01.transform.parent = transform.root;
		_lightinigEmmiterInstant02.transform.parent = transform.root;
		_lightinigEmmiterInstant03.transform.parent = transform.root;
		_lightinigEmmiterInstant04.transform.parent = transform.root;
		_lightinigEmmiterBolt01 = _lightinigEmmiterInstant01.GetComponent < LightningBolt > ();
		_lightinigEmmiterBolt02 = _lightinigEmmiterInstant02.GetComponent < LightningBolt > ();
		_lightinigEmmiterBolt03 = _lightinigEmmiterInstant03.GetComponent < LightningBolt > ();
		_lightinigEmmiterBolt04 = _lightinigEmmiterInstant04.GetComponent < LightningBolt > ();
		_lightinigTargetInstant03 = new GameObject ( "target03" );
		_lightinigTargetInstant04 = new GameObject ( "target04" );
		_myHandleChoosenCharacter = handleBuild;
		_myMaterial = gameObject.renderer.material;
		
		_rememberedPositionOnMouseDown = new int[2];
	}
コード例 #2
0
	//*************************************************************//	
	void Start () 
	{
		_myIComponent = gameObject.GetComponent < IComponent > ();
		_myHandleChoosenCharacter = handleDemolish;
		myID = transform.parent.Find("tile").GetComponent < IComponent > ().myID;
		if(myID == 71 || myID == 74 || myID == 92)
		{
			MNLevelControl.getInstance().objectsOfValue += 1;
		}
	}
コード例 #3
0
	//*************************************************************//	
	IEnumerator Start () 
	{
		_myHandleChoosenCharacter = handlePutOnTroley;
		_myIComponent = gameObject.GetComponent < IComponent > ();

		yield return new WaitForSeconds ( 0.5f );
		GameObject coraObject = LevelControl.getInstance ().getCharacterObjectFromLevel ( GameElements.CHAR_CORA_1_IDLE );
		coraObject.transform.Find ( "tile" ).SendMessage ( "handleTouched" );
		GetComponent < SelectedComponenent > ().setSelected ( true, true );
		Main.getInstance ().interactWithCurrentCharacter ( _myHandleChoosenCharacter, CharacterData.CHARACTER_ACTION_TYPE_RESCUING, _myIComponent );
	}
コード例 #4
0
	//=======================Daves Work======================

	//*************************************************************//	
	void Start () 
	{
		myParticles = (GameObject)Resources.Load ("Particles/elecSparks");
		_myHandleEnemySelected = handleAttackedByCharacted;
		_handleAttackExecuted = handleAttackedButtonPressed;
		_myIComponent = gameObject.GetComponent < IComponent > ();
		_mySelectedComponent = gameObject.GetComponent < SelectedComponenent > ();
		myParticlesInstance = (GameObject)Instantiate (myParticles, transform.position, transform.rotation);
		//myParticles.transform.eulerAngles = new Vector3 (transform.eulerAngles.x, -transform.eulerAngles.y, transform.eulerAngles.z);
		myParticlesInstance.SetActive(false);
		
		_lookRightLocalScale = transform.localScale.x;
	}
コード例 #5
0
	void Start () 
	{
		_myHandleEnemySelected = handleAttackedByCharacted;
		_handleAttackExecuted = handleAttackedButtonPressed;
		_myIComponent = gameObject.GetComponent < IComponent > ();
		_mySelectedComponent = gameObject.GetComponent < SelectedComponenent > ();
		if(_myIComponent.myID == GameElements.ENEM_TENTACLEDRAINER_01 || _myIComponent.myID == GameElements.ENEM_TENTACLEDRAINER_02)
		{
			myParticlesInstance = (GameObject)Instantiate (myParticles, transform.position, transform.rotation);
			//myParticles.transform.eulerAngles = new Vector3 (transform.eulerAngles.x, -transform.eulerAngles.y, transform.eulerAngles.z);
			myParticlesInstance.SetActive(false);
		}
		_lookRightLocalScale = transform.localScale.x;
		//=======================Daves Work======================
		myTargets = new List<GameObject> ();
		foreach(GameObject character in GameObject.FindGameObjectsWithTag("Character"))
		{
			myTargets.Add(character);
		}
	}
コード例 #6
0
	public bool initMove ( int[][] path, int[] target, bool ommitLastNode, CharacterData characterData, Main.HandleChoosenCharacter myCallBackOnFinish ) 
	{
		if (( _myPath != null ) && ( _myPath[_nodeID] != null ))
		{
			FLGridReservationManager.getInstance ().fillTileWithMe ( GameElements.EMPTY, _myPath[_nodeID][0], _myPath[_nodeID][1], this.gameObject, _myIComponent.myID  );
			FLGridReservationManager.getInstance ().fillTileWithMe ( _myIComponent.myID, _myIComponent.position[0], _myIComponent.position[1], this.gameObject, _myIComponent.myID  );
		}
		
		_myCallBackOnFinish = myCallBackOnFinish;
		
		_nodeID = 1;
		_ommitLastNode = ommitLastNode;
		_target = target;
		
		if (( path != null ) && ( path[_nodeID] != null ) && ( ToolsJerry.compareTiles ( path[0], _myIComponent.position )) && FLLevelControl.getInstance ().allPathIsWalkableForCharacter ( _myIComponent.myID, this.gameObject, path ))
		{
			_myPath = path;
			
			switchTextures ( _myIComponent.position, _myPath[_nodeID] );
			isMoving = true;
			FLGridReservationManager.getInstance ().fillTileWithMe ( _myIComponent.myID, _myPath[_nodeID][0], _myPath[_nodeID][1], this.gameObject, _myIComponent.myID  );
			
			Vector3 positionToGo = new Vector3 ((float) _myPath[_nodeID][0], (float) ( FLLevelControl.LEVEL_HEIGHT - _myPath[_nodeID][1] ), (float) _myPath[_nodeID][1] - 0.5f );
			float distanceToNewPosition = Vector3.Distance ( transform.position, positionToGo );
			iTween.MoveTo ( this.gameObject, iTween.Hash ( "time", distanceToNewPosition / 4f, "easetype", iTween.EaseType.linear, "position", positionToGo, "oncomplete", "onCompleteTweenAnimation" ));
			
			return true;
		}
		else
		{
			if ( _myCallBackOnFinish != null ) _myCallBackOnFinish ( _myIComponent.myCharacterData );
			else MessageCenter.getInstance ().createMarkInPosition ( target );
			
			return false;
		}
	}
コード例 #7
0
	public void initMove ( int[][] path, int[] target, bool ommitLastNode, CharacterData characterData, Main.HandleChoosenCharacter myCallBackOnFinish ) 
	{
		iTween.Stop ( this.gameObject );

		if (( _myPath != null ) && ( _myPath[_nodeID] != null ))
		{
			GridReservationManager.getInstance ().fillTileWithMe ( GameElements.EMPTY, _myPath[_nodeID][0], _myPath[_nodeID][1], this.gameObject, _myIComponent.myID  );
			GridReservationManager.getInstance ().fillTileWithMe ( _myIComponent.myID, _myIComponent.position[0], _myIComponent.position[1], this.gameObject, _myIComponent.myID  );
		}
		
		_target = target;
		_ommitLastNode = ommitLastNode;
		
		_myCallBackOnFinish = myCallBackOnFinish;
		if ( _myCallBackOnFinish != null ) _myCallBackOnFinish ( null, true );
		
		_nodeID = 1;

		if (( path != null ) && ( path[_nodeID] != null ) && ( ToolsJerry.compareTiles ( path[0], _myIComponent.position )) && LevelControl.getInstance ().allPathIsWalkableForCharacter ( _myIComponent.myID, this.gameObject, path ))
		{
			_myPath = path;
			switchTextures ( _myIComponent.position, _myPath[_nodeID] );
			
			if ( LevelControl.getInstance ().gameElementsOnLevel[LevelControl.GRID_LAYER_NORMAL][path[_nodeID][0]][path[_nodeID][1]] != null )
			{
				if ( Array.IndexOf ( GameElements.CHARACTERS, LevelControl.getInstance ().levelGrid[LevelControl.GRID_LAYER_NORMAL][path[_nodeID][0]][path[_nodeID][1]] ) != -1 )
				{
					if ( LevelControl.getInstance ().gameElementsOnLevel[LevelControl.GRID_LAYER_NORMAL][path[_nodeID][0]][path[_nodeID][1]] != this.gameObject )
					{
						_electricShockExecuted = false;
						_myIComponent.myCharacterData.blocked = false;
						isMoving = false;
						transform.Find ( "tile" ).GetComponent < CharacterAnimationControl > ().playAnimation ( CharacterAnimationControl.IDLE_01_ANIMATION );
						Vector3 positionToBumpTo = new Vector3 (((float) path[_nodeID][0] ) + ((float) ( _myIComponent.position[0] - path[_nodeID][0] )) / 2f, (float) ( LevelControl.LEVEL_HEIGHT - path[_nodeID][1] ), ((float) path[_nodeID][1] ) + ((float) ( _myIComponent.position[1] - path[_nodeID][1] )) / 2f + 0.33f - 0.5f );
						transform.Find ( "tile" ).GetComponent < SelectedComponenent > ().setSelectedForPassingCharacter ( true, positionToBumpTo );
						LevelControl.getInstance ().gameElementsOnLevel[LevelControl.GRID_LAYER_NORMAL][path[_nodeID][0]][path[_nodeID][1]].transform.Find ( "tile" ).GetComponent < SelectedComponenent > ().setSelectedForPassingCharacter ( true, Vector3.zero );
						
						if ( _myIComponent.myCharacterData.interactAction )
						{
							_myIComponent.myCharacterData.interactAction = false;
							Main.getInstance ().revokeRedirectorCallBack ();
							if ( _myIComponent.myCharacterData.myCallBack != null ) _myIComponent.myCharacterData.myCallBack ( null, true );
						}
						return;
					}
				}
			}
			
			_tileJustBefore = ToolsJerry.cloneTile ( _myIComponent.position );
			
			isMoving = true;
			GridReservationManager.getInstance ().fillTileWithMe ( _myIComponent.myID, _myPath[_nodeID][0], _myPath[_nodeID][1], this.gameObject, _myIComponent.myID  );
			
			Vector3 positionToGo = new Vector3 ((float) _myPath[_nodeID][0], (float) ( LevelControl.LEVEL_HEIGHT - _myPath[_nodeID][1] ), (float) _myPath[_nodeID][1] - 0.5f );
			float distanceToNewPosition = Vector3.Distance ( transform.position, positionToGo );
			iTween.MoveTo ( this.gameObject, iTween.Hash ( "time", distanceToNewPosition / 4f, "easetype", iTween.EaseType.linear, "position", positionToGo, "oncomplete", "onCompleteTweenAnimation" ));
		}
		else
		{
			if ( LevelControl.getInstance ().levelGrid[LevelControl.GRID_LAYER_BEAM][_myIComponent.position[0]][_myIComponent.position[1]] == GameElements.EMPTY || Array.IndexOf ( GameElements.BUILDERS, _myIComponent.myID ) != -1 )
			{
				if ( _myCallBackOnFinish != null ) _myCallBackOnFinish ( _myIComponent.myCharacterData );
				else MessageCenter.getInstance ().createMarkInPosition ( target );
			}
		}
	}
コード例 #8
0
	//*************************************************************//	
	void Start () 
	{
		_myHandleChoosenCharacter = handlePutOnTroley;
		_myIComponent = gameObject.GetComponent < IComponent > ();
	}
コード例 #9
0
	//*************************************************************//	
	void Start () 
	{
		_myIComponent = gameObject.GetComponent < IComponent > ();
		_myHandleChoosenCharacter = handleDemolish;
		myID = transform.parent.Find("tile").GetComponent < IComponent > ().myID;
	}
コード例 #10
0
	//*************************************************************//	
	void Start () 
	{
		_myIComponent = gameObject.GetComponent < IComponent > ();
		_myHandleChoosenCharacter = handleDemolish;
	}