Esempio n. 1
0
    protected override void Attack(GameObject target)
    {
        Look(target.transform.position - transform.position);
        GameObject newBullet = Instantiate(bullet, CustomLib.MoveInDirection(transform.position, target.transform.position, transform.localScale.x), transform.rotation);

        newBullet.transform.localScale.Scale(transform.localScale);
    }
 protected override void Attack(GameObject target)
 {
     Look(target.transform.position - transform.position);
     if (fireSpit != null)
     {
         Instantiate(fireSpit, CustomLib.MoveInDirection(transform.position, target.transform.position, transform.localScale.x), transform.rotation);
     }
 }
Esempio n. 3
0
 public virtual void GetAway(float dir) // The speaker asks the unit to move away
 {
     if (!isOrderedToMove)
     {
         isOrderedToMove = true;
         Vector3 targetPos = CustomLib.MoveInDirection(transform.position, dir, 0.5f);
         GoThere(targetPos);
     }
 }
Esempio n. 4
0
    private void RefreshTarget()
    {
        if (target == null)
        {
            GoThere(transform.position);
            return;
        }
        Vector3 targetPosition = CustomLib.MoveInDirection(target.transform.position, transform.position, (target.transform.localScale.x / 2f) + range - 0.1f);

        GoThere(targetPosition);
    }
    public void UpdateShape(float angle)
    {
        List <Vector3> newPositions = new List <Vector3>();

        if (angle < 360)
        {
            newPositions.Add(transform.position + Vector3.forward * -0.1f);
        }
        for (float teta = -angle / 2f; teta < angle / 2f; teta += 10)
        {
            newPositions.Add(CustomLib.MoveInDirection(transform.position, (transform.rotation.eulerAngles.z + teta) * Mathf.Deg2Rad, effectSize) + Vector3.forward * -0.1f);
        }
        newPositions.Add(CustomLib.MoveInDirection(transform.position, (transform.rotation.eulerAngles.z + angle / 2f) * Mathf.Deg2Rad, effectSize) + Vector3.forward * -0.1f);
        lineRenderer.positionCount = newPositions.Count;
        lineRenderer.SetPositions(newPositions.ToArray());
    }