Exemple #1
0
 void Start()
 {
     m_collider = GetComponent<BoxCollider>();
     m_parabola = new Parabola(gameObject, Random.Range(5f, 8f), Random.Range(-3.14f, 3.14f), Random.Range(1.3f, 1.57f), 2);
     m_parabola.GroundY = 0.5f;
     m_parabola.TimeScale = 1.5f;
     LifeTime = m_lifeTime;
 }
Exemple #2
0
    public override void Init(Creature ownerCreature, Weapon weapon, Weapon.FiringDesc targetAngle)
    {
        base.Init(ownerCreature, weapon, targetAngle);

        m_status = Status.Dropping;
        //m_parabola = new Parabola(gameObject, m_speed, -targetAngle.angle * Mathf.Deg2Rad, Random.Range(45f, 85f) * Mathf.Deg2Rad, m_bouncing);
        m_parabola = new Parabola(gameObject, m_speed, -ownerCreature.transform.rotation.eulerAngles.y * Mathf.Deg2Rad, Random.Range(45f, 85f) * Mathf.Deg2Rad, m_bouncing);
    }
 void Update()
 {
     if (m_parabola != null && false == m_parabola.Update())
     {
         m_creature.CrowdControl(Creature.CrowdControlType.LeapStrike, false);
         CreateBullet(m_firingDescs[0], transform.position);
         m_parabola = null;
         m_effectTargetingPoint.Death();
     }
 }
Exemple #4
0
    public override void Init(Creature mob)
    {
        base.Init(mob);

        m_parabola = new Parabola(mob.gameObject,
                                  Random.Range(m_hSpeed[0], m_hSpeed[1]),
                                   Random.Range(m_vRadian[0], m_vRadian[1]),
                                  Random.Range(m_hRadian[0], m_hRadian[1]),
                                  1);
    }
Exemple #5
0
        public void CalculateParabolaMinimum()
        {
            int _dim=5;
            double []_data = {5,34,-12,55,6};
            double []_reference = {0,0,0,0,0};
            double _epsilon=1e-7;
            double _realEpsilon = System.Math.Sqrt(_epsilon);
            double _step=1000;
            int _itmax=1000;
            double diff;

            Parabola func = new Parabola(_dim);
            Nelder objNelder = new Nelder(_dim,_data,func,_step,_epsilon,_itmax);
            objNelder.FindMinimum();
            diff = NumericNet.CalcDiff(_dim,_reference,objNelder.Result);
            Assert.IsTrue(diff<_realEpsilon);
        }
    public override void StartFiring(float targetAngle)
    {
        if ( isCoolTime() == true && m_creature.Targetting != null)
        {
            float d = Vector3.Distance(m_creature.transform.position, m_creature.Targetting.transform.position);

            m_parabola = new Parabola(m_creature.gameObject, d*1.7f, targetAngle*Mathf.Deg2Rad, 80*Mathf.Deg2Rad, 1);
            m_parabola.TimeScale = 0.80f;

            m_effectTargetingPoint = new EffectTargetingCircle();
            m_effectTargetingPoint.Init(m_parabola.DestPosition);

            m_creature.CrowdControl(Creature.CrowdControlType.LeapStrike, true);

            DidStartFiring(0f);
        }
        m_firing = true;
    }
    public void Init(Creature obj, string damage, Color color, MovementType movementType)
    {
        m_movementType = movementType;
        m_target = obj;
        m_targetPos = obj.transform.position+m_target.HPPointTransform.localPosition;
        m_targetPos.y += 1;
        transform.position = m_targetPos;
        m_startTime = Time.time;
        m_posY = 0f;

        m_text = GetComponent<TypogenicText>();
        m_text.Text = damage;
        m_text.ColorTopLeft = color;
        //transform.localScale = Vector3.one/2f;

        if (movementType == MovementType.Parabola || movementType == MovementType.ParabolaAlpha)
        {
            float[] angs = {80,100};
            m_parabola = new Parabola(gameObject, 6f, 0f,angs[Random.Range(0, angs.Length)]*Mathf.Deg2Rad, 1);
        }
    }
Exemple #8
0
	void OnTriggerEnter(Collider other)
	{
        rock = other.GetComponent<Rock>();
		para = other.GetComponent<Parabola>();
		if(other.tag == "weapon")
		{

			//Debug.Log (relativePos);
			//Quaternion q;
			//q.SetFromToRotation;
			tempObj = other.gameObject;


				//Debug.Log("else");
				isMeet = true;
				rock.enWeapon = 0;


            

			//other.transform.rotation= transform.rotation;
		}
		//Debug.Log(other.tag);
	}
 protected virtual void createParabola(float targetAngle)
 {
     m_parabola = new Parabola(gameObject, m_speed, -(transform.rotation.eulerAngles.y + targetAngle) * Mathf.Deg2Rad, Random.Range(m_yangles[0],m_yangles[1]) * Mathf.Deg2Rad, m_bouncing);
 }
Exemple #10
0
	// Update is called once per frame
	void Update () 
	{
		#if UNITY_IPHONE
		int i = 0;
		    
		if ( Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Began)
		{
			this.mousepos = Camera.main.ScreenToWorldPoint(Input.GetTouch(i).position);
			//this.mousepos = Input.GetTouch(i).position;

			mousepos = new Vector3(mousepos.x, mousepos.y, 0);

			if (!isClike)
			{
				 obj = Instantiate(this.pointer, mousepos, Quaternion.identity) as GameObject;
				text.text = i.ToString() +"@" + this.mousepos.ToString();
				 isClike = true;
			}
		}

		//if (Input.GetMouseButtonUp(0))
		if (Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Ended)
		{
		    isClike = false;
		}
		#endif

		#if UNITY_STANDALONE_WIN
		////////////////////////////////////////////////mouse//////////////////////////////////////
//		if(Input.GetMouseButtonDown(0))
//		{
//			rock.collider.bounds.
//			Debug.Log("down");
//		}
		if (Input.GetMouseButtonDown(0))
		{
			ray = Camera.main.ScreenPointToRay(Input.mousePosition);
			if (Physics.Raycast(ray, out hit))
			{
				GameObject obj;
//				obj = hit.collider.gameObject.transform.parent.gameObject;
//				if(obj == null)
//				{
					obj = hit.collider.gameObject;
				Debug.Log(tileMap.data.tileSize);
				//}

				rockObj = obj.GetComponent<Rock>(); //取不到值?????
				para = obj.GetComponent<Parabola>();
				Debug.Log(obj.name);
				Debug.Log(hit.collider.gameObject.name);
				Debug.Log(rockObj);
				//if(rockObj != null)
				if(obj.tag == "ground")
				{
					tSprite = obj.GetComponent<tk2dTiledSprite>();
					tSprite.color = Color.yellow;

				}
				//obj.gameObject.
				if(rockObj != null )
				{
					rockObj.State = Rock.RockStateEnum.act4;
					//para.active = false;
					Debug.Log(hit.collider.gameObject.name);
				}
			}
//			Ray ray;
//			RaycastHit hit;
//
//				if (Input.GetMouseButton(0))
//				{
//					ray = Camera.main.ScreenPointToRay(Input.mousePosition);
//					if (Physics.Raycast(ray, out hit))
//						Debug.Log(hit.collider.gameObject.name);
//				}


		}

        if (Input.GetMouseButton(0))
        {
            this.mousepos = Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, Input.mousePosition.z));

            mousepos = new Vector3(mousepos.x, mousepos.y, 0);
            if (!isClike)
            {
                obj = Instantiate(this.pointer, mousepos, Quaternion.identity) as GameObject;
                
                isClike = true;
            }

        }
        if (Input.GetMouseButtonUp(0))
        {
            isClike = false;
        }
		////////////////////////////////////////////////mouse//////////////////////////////////////
		#endif
		

		
	}
Exemple #11
0
    IEnumerator EffectAirborne()
    {
        if (gameObject != null)
        {
            DamageText(CrowdControlType.Airborne.ToString(), Vector3.one, Color.white, DamageNumberSprite.MovementType.FloatingUp);
            CrowdControl(CrowdControlType.Airborne, true);
            Parabola parabola = new Parabola(gameObject, 8, 0f, 90*Mathf.Deg2Rad, 1);
            while(parabola.Update())
            {
                yield return null;
            }

            m_buffEffects[(int)DamageDesc.BuffType.Airborne].m_run = false;
            CrowdControl(CrowdControlType.Airborne, false);
        }
    }
 protected override void createParabola(float targetAngle)
 {
     m_parabola = new Parabola(gameObject, m_speed, -(transform.rotation.eulerAngles.y+targetAngle) * Mathf.Deg2Rad, Random.Range(1f, 1.4f), m_bouncing);
     m_effectTargetingPoint.Init(m_parabola.DestPosition);
 }
 void Start()
 {
     m_parabola = new Parabola(gameObject, Random.Range(5f, 8f), Random.Range(-3.14f, 3.14f), Random.Range(1.0f, 1.57f), 3);
     rigidbody.AddTorque(Random.Range(0f, 2f), Random.Range(0f, 2f), Random.Range(0f, 2f), ForceMode.Impulse);
 }