Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class Ranged : Skillverhalten {
- private const string name = "Ranged";
- private const string Tooltip = "Eine Range Attack!";
- private const VerhaltenStartZeit startTime = VerhaltenStartZeit.Beginning;
- private float minDistance;
- private float maxDistance;
- private bool isRandomm;
- private float lifedistance;
- public Ranged(float minDist, float maxDist, bool isRandom)
- : base(new BasicObjectInfos(name, Tooltip), startTime){
- minDistance = minDist;
- maxDistance = maxDist;
- isRandomm = isRandom;
- }
- public override void PerformVerhalten(Vector3 startPosition)
- {
- lifedistance = isRandomm ? Random.Range(minDistance, maxDistance) : maxDistance;
- StartCoroutine (CheckDistance (startPosition));
- }
- private IEnumerable CheckDistance(Vector3 startPosition){
- float tempdistance = Vector3.Distance (startPosition, this.transform.position);
- while (tempdistance > lifedistance) {
- tempdistance = Vector3.Distance (startPosition, this.transform.position);
- }
- this.gameObject.SetActive (false);
- yield return null;
- }
- public float MinDistance{
- get {return minDistance; }
- }
- public float MaxDistance{
- get {return maxDistance; }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement