Exemple #1
0
	void OnEnable()
	{
		spawnDirection = Camera.main.transform.parent.eulerAngles;
		this.transform.eulerAngles = spawnDirection;
		health = startHealth;
		velocityX = maxVelocityX;
		if(movementType == MovementType.B)
		{
			StatsBMovement();
			if(Random.Range(0,2) == 0)
				zigZagDir = ZigZagDir.Left;
			else
				zigZagDir = ZigZagDir.Right;
		}
		else if(movementType == MovementType.C)
		{
			StatsBMovement();
			if(Random.Range(0,2) == 0)
				zigZagDir = ZigZagDir.Left;
			else
				zigZagDir = ZigZagDir.Right;
		}
		else if(movementType == MovementType.D)
		{
			StatsDMovement();
		}
		else
			StatsAMovement();
	}
Exemple #2
0
	Vector3 MovementPong()
	{
		switch(checkSensor())
		{
		case 0: // Nothing obstructed
			movType.InsertInfo(enginePowerX,enginePowerZ,accelerationX,accelerationZ,friction,velocityX,velocityZ,maxVelocityX,maxVelocityZ, (int)movementType, spawnDirection);
			return movType.MoveNormal() + movType.MovePong((int)zigZagDir);
			
		case 1: // obstructed in front.
			movType.InsertInfo(enginePowerX,enginePowerZ,accelerationX,accelerationZ,friction,velocityX,velocityZ,maxVelocityX,maxVelocityZ, (int)movementType, spawnDirection);
			return movType.MoveSlow() + movType.MovePong((int)zigZagDir);
			
		case 2: // offscreen Left
			movType.InsertInfo(enginePowerX,enginePowerZ,accelerationX,accelerationZ,friction,velocityX,velocityZ,maxVelocityX,maxVelocityZ, (int)movementType, spawnDirection);
			zigZagDir = ZigZagDir.Right;
			return movType.MoveNormal() + movType.MovePong((int)zigZagDir);
			
		case 3: // offscreen Right
			movType.InsertInfo(enginePowerX,enginePowerZ,accelerationX,accelerationZ,friction,velocityX,velocityZ,maxVelocityX,maxVelocityZ, (int)movementType, spawnDirection);
			zigZagDir = ZigZagDir.Left;
			return movType.MoveNormal() + movType.MovePong((int)zigZagDir);
			
		case 4: // offscreen Left and obstructed front
			movType.InsertInfo(enginePowerX,enginePowerZ,accelerationX,accelerationZ,friction,velocityX,velocityZ,maxVelocityX,maxVelocityZ, (int)movementType, spawnDirection);
			zigZagDir = ZigZagDir.Right;
			return movType.MoveSlow() + movType.MovePong((int)zigZagDir);
			
		case 5: // offscreen Right and obstructed front
			movType.InsertInfo(enginePowerX,enginePowerZ,accelerationX,accelerationZ,friction,velocityX,velocityZ,maxVelocityX,maxVelocityZ, (int)movementType, spawnDirection);
			zigZagDir = ZigZagDir.Left;
			return movType.MoveSlow() + movType.MovePong((int)zigZagDir);
			
		case 6: // obstructed front and left.
			movType.InsertInfo(enginePowerX,enginePowerZ,accelerationX,accelerationZ,friction,velocityX,velocityZ,maxVelocityX,maxVelocityZ, (int)movementType, spawnDirection);
			zigZagDir = ZigZagDir.Right;
			return movType.MoveSlow() + movType.MovePong((int)zigZagDir);
			
		case 7: // obstructed front and right.
			movType.InsertInfo(enginePowerX,enginePowerZ,accelerationX,accelerationZ,friction,velocityX,velocityZ,maxVelocityX,maxVelocityZ, (int)movementType, spawnDirection);
			zigZagDir = ZigZagDir.Left;
			return movType.MoveSlow() + movType.MovePong((int)zigZagDir);
			
		case 8: // obstructed front, left and right.
			movType.InsertInfo(enginePowerX,enginePowerZ,accelerationX,accelerationZ,friction,velocityX,velocityZ,maxVelocityX,maxVelocityZ, (int)movementType, spawnDirection);
			return movType.MoveSlow() + movType.noBank();
			
		case 9: // obstructed right.
			movType.InsertInfo(enginePowerX,enginePowerZ,accelerationX,accelerationZ,friction,velocityX,velocityZ,maxVelocityX,maxVelocityZ, (int)movementType, spawnDirection);
			zigZagDir = ZigZagDir.Left;
			return movType.MoveNormal() + movType.MovePong((int)zigZagDir);
			
		case 10: // obstructed left.
			movType.InsertInfo(enginePowerX,enginePowerZ,accelerationX,accelerationZ,friction,velocityX,velocityZ,maxVelocityX,maxVelocityZ, (int)movementType, spawnDirection);
			zigZagDir = ZigZagDir.Right;
			return movType.MoveNormal() + movType.MovePong((int)zigZagDir);
			
		case 11: // obstructed right and left.
			movType.InsertInfo(enginePowerX,enginePowerZ,accelerationX,accelerationZ,friction,velocityX,velocityZ,maxVelocityX,maxVelocityZ, (int)movementType, spawnDirection);
			return movType.MoveNormal() + movType.noBank();
			
		default:  // Nothing obstructed
			movType.InsertInfo(enginePowerX,enginePowerZ,accelerationX,accelerationZ,friction,velocityX,velocityZ,maxVelocityX,maxVelocityZ, (int)movementType, spawnDirection);
			return movType.MoveNormal() + movType.MovePong((int)zigZagDir);
		}
	}