Exemplo n.º 1
0
 override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
 {
     agent                = animator.GetComponent <EnnemiEpee_CollisionDetector>().agent;
     deflect              = animator.GetComponentInChildren <SwordCollision>();
     foot                 = GameObject.FindGameObjectWithTag("Foot").GetComponent <BoxCollider>();
     foot.enabled         = true;
     agent.updateRotation = false;
 }
Exemplo n.º 2
0
 override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
 {
     agent   = animator.GetComponent <EnnemiEpee_CollisionDetector>().agent;
     deflect = animator.GetComponentInChildren <SwordCollision>();
     SwordCollision.damage    = 4;
     SwordCollision.knockback = knockback;
     idle = animator.GetBehaviour <EnnemisEppee_V2>();
     agent.updateRotation = false;
     agent.speed          = attackSpeed;
 }
Exemplo n.º 3
0
 override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
 {
     agent = animator.GetComponent <EnnemiEpee_CollisionDetector>().agent;
     agent.updateRotation = false;
     deflect                  = animator.GetComponentInChildren <SwordCollision>();
     deflectImpact            = animator.GetBehaviour <DeflectImpact>();
     deflectImpact.isImpacted = false;
     SwordCollision.damage    = 3;
     SwordCollision.knockback = knockback;
     idle            = animator.GetBehaviour <EnnemisEppee_V2>();
     idle.isBlocking = false;
     agent.speed     = attackSpeed;
     //sword = GameObject.FindGameObjectWithTag("Sword").GetComponent<BoxCollider>();
 }
Exemplo n.º 4
0
    protected override void DoItem()
    {
//		Debug.LogWarning("[DoItem]");

        ActuallyUsingItem();

        SoundManager.Instance.PlayOneShot("sword_sfx");

        swordEffectInstance     = (Instantiate(effectPrefab) as GameObject).transform;
        swordEffectInstanceLama = swordEffectInstance.GetChild(0);
        swordAnimation          = swordEffectInstanceLama.GetComponentInChildren <Animation>();

        int rotateDirection = Vector3.Dot(Vector3.right, swipeDirecion) > 0 ? 1 : -1;

        swordEffectInstance.position     = startPosition;
        swordEffectInstanceLama.rotation = Quaternion.LookRotation(rotateDirection * swipeDirecion.normalized);

        Vector3 newRot = swordEffectInstanceLama.localEulerAngles;

        newRot.y = 90f;
        swordEffectInstanceLama.localEulerAngles = newRot;

        swordEffectInstance.RotateAround(swordEffectInstance.position, swipeDirecion, -rotateDirection * 25f);

        swordCollision = swordEffectInstance.GetComponent <SwordCollision>();
        swordCollision.OnTargetDestroyed += ActionOnTileDestroyed;

        if (rotateDirection == 1)
        {
            swordAnimation["effect_swordswing"].speed = 1f;
            swordAnimation.Play("effect_swordswing");
        }
        else
        {
            swordAnimation["effect_swordswing"].speed          = -1f;
            swordAnimation["effect_swordswing"].normalizedTime = 1f;
            swordAnimation.Play("effect_swordswing");
        }

        positionTweener = HOTween.To(swordEffectInstance.transform, swordMovementSpeed,
                                     new TweenParms().Prop("position", endPosition)
                                     .Ease(EaseType.Linear)
                                     .SpeedBased()
                                     .OnComplete(ActionOnTweenComplete)
                                     );
    }
Exemplo n.º 5
0
    // Update is called once per frame
    void Update()
    {
        //Grabs the sword collision method to adjust the moving variable within it.
        SwordCollision swordCollision = sword.GetComponent <SwordCollision>();


        //Sword orientation in relation to both the camera and the player.

        sword.GetComponent <Rigidbody>().MovePosition(Vector3.Lerp(sword.transform.position, Camera.main.transform.position + 0.3f *
                                                                   Camera.main.transform.right + 1.7f * Camera.main.transform.forward, 50f * Time.deltaTime));


        //hands.transform.position = Camera.main.transform.position + 0.3f * Camera.main.transform.right + 0.9f * Camera.main.transform.forward;

        sword.transform.rotation = Camera.main.transform.rotation * new Quaternion(0.1f, 5f, 2.9f, 0.9f);



        //Swings the sword the player has.
        if (Input.GetKey(KeyCode.Space))
        {
            swordCollision.swordMoving = true;
            if (timer < swingTime)
            {
                timer += Time.deltaTime;
                sword.transform.rotation = Camera.main.transform.rotation * new Quaternion(-2.2f, 1.5f, 4.9f, 1f);

                sword.transform.position = Vector3.Lerp(sword.transform.position, transform.position +
                                                        -0.5f * Camera.main.transform.right + 0.1f * Camera.main.transform.forward, 8f * Time.deltaTime);
            }
            else
            {
                sword.transform.position = Vector3.Lerp(sword.transform.position, Camera.main.transform.position + 0.3f *
                                                        Camera.main.transform.right + 1.7f * Camera.main.transform.forward, 8f * Time.deltaTime);
            }
        }
        else
        {
            timer = 0f;
            swordCollision.swordMoving = false;
        }
    }
Exemplo n.º 6
0
	protected override void DoItem()
	{	
//		Debug.LogWarning("[DoItem]");
		
		ActuallyUsingItem();
		
		SoundManager.Instance.PlayOneShot("sword_sfx");
		
		swordEffectInstance = (Instantiate(effectPrefab) as GameObject).transform;
		swordEffectInstanceLama = swordEffectInstance.GetChild(0);
		swordAnimation = swordEffectInstanceLama.GetComponentInChildren<Animation>();
		
		int rotateDirection = Vector3.Dot(Vector3.right, swipeDirecion) > 0 ? 1 : -1;
		
		swordEffectInstance.position = startPosition;
		swordEffectInstanceLama.rotation = Quaternion.LookRotation(rotateDirection * swipeDirecion.normalized);
		
		Vector3 newRot = swordEffectInstanceLama.localEulerAngles;
		newRot.y = 90f;
		swordEffectInstanceLama.localEulerAngles = newRot;
		
		swordEffectInstance.RotateAround(swordEffectInstance.position, swipeDirecion,  -rotateDirection * 25f);
		
		swordCollision = swordEffectInstance.GetComponent<SwordCollision>();
		swordCollision.OnTargetDestroyed += ActionOnTileDestroyed;
		
		if(rotateDirection == 1)
		{
			swordAnimation["effect_swordswing"].speed = 1f;
			swordAnimation.Play("effect_swordswing");
		}
		else 
		{
			swordAnimation["effect_swordswing"].speed = -1f;
			swordAnimation["effect_swordswing"].normalizedTime = 1f;
			swordAnimation.Play("effect_swordswing");
		}
		
		positionTweener = HOTween.To(swordEffectInstance.transform, swordMovementSpeed, 
											new TweenParms().Prop("position", endPosition)
											.Ease(EaseType.Linear)
											.SpeedBased()
											.OnComplete(ActionOnTweenComplete)
										 );
	}