コード例 #1
0
    // Use this for initialization
    void Start()
    {
        this.mapActor       = this.GetComponent <MapActor>();
        this.spriteRenderer = this.GetComponent <SpriteRenderer>();
        if (this.spriteRenderer == null)
        {
            this.spriteRenderer = this.GetComponentInChildren <SpriteRenderer>();
        }

        if (this.spriteRenderer == null)
        {
            Debug.LogError("No SpriteRenderer found on MapFloater gameObject: " + gameObject.name);
            this.enabled = false;
            return;
        }

        if (this.floatingSprite == null)
        {
            Debug.LogError("No Floating Sprite found on MapFloater gameObject: " + gameObject.name);
            this.enabled = false;
            return;
        }
        this.originalSprite        = this.spriteRenderer.sprite;
        this.originalLayeringOrder = this.spriteRenderer.sortingOrder;
        this.mapObjectCell         = this.GetComponentInChildren <MapObjectCell>();
        this.RectTransform         = this.GetComponent <RectTransform>();
        this.gameManager           = GameManager.GetGameManager();
        this.pushawayCoroutines    = new Queue <Coroutine>();
        this.blinkCoroutines       = new Queue <Coroutine>();
    }
コード例 #2
0
    // will need to rewrite soon
    public void TargetAttack(MapActor target)
    {
        float dx = Mathf.Abs(unit.transform.position.x - target.transform.position.x);
        float dz = Mathf.Abs(unit.transform.position.z - target.transform.position.z);

        Debug.Log("Targeting: " + dx + " + " + dz);
        Vector3    distanceBetween = target.transform.position - unit.transform.position;
        RaycastHit hit             = new RaycastHit();

        if ((dx + dz) <= 7.0f &&
            Physics.Raycast(unit.transform.position, (distanceBetween).normalized, out hit, distanceBetween.magnitude))
        {
            if (hit.collider.gameObject.Equals(target))
            {
                Debug.DrawLine(unit.transform.position, target.transform.position, Color.red);
                Debug.Log("HIT!");
                CommitToAttack(target);
            }
            else
            {
                CommitToAttack(hit.collider.gameObject.GetComponent <CharacterBehavior>());
            }
        }
    }
コード例 #3
0
 // will need to rewrite soon
 public void TargetAttack(MapActor target)
 {
     float dx = Mathf.Abs(unit.transform.position.x - target.transform.position.x);
     float dz = Mathf.Abs(unit.transform.position.z - target.transform.position.z);
     Debug.Log ("Targeting: " + dx + " + " + dz);
     Vector3 distanceBetween = target.transform.position - unit.transform.position;
     RaycastHit hit = new RaycastHit();
     if ((dx + dz) <= 7.0f &&
         Physics.Raycast(unit.transform.position, (distanceBetween).normalized, out hit, distanceBetween.magnitude)) {
         if(hit.collider.gameObject.Equals(target)){
             Debug.DrawLine(unit.transform.position, target.transform.position,Color.red);
             Debug.Log ("HIT!");
             CommitToAttack(target);
         }
         else{
             CommitToAttack(hit.collider.gameObject.GetComponent<CharacterBehavior>());
         }
     }
 }
コード例 #4
0
 public void CommitToAttack(MapActor target)
 {
     Attack attack = new Attack (unit, target, true);
     StartCoroutine(Execute (attack));
 }
コード例 #5
0
 public Attack(MapActor a, MapActor t, bool s)
 {
     actor   = a;
     target  = t;
     success = s;
 }
コード例 #6
0
 public Movement(MapActor a, List <TileBehavior> p, bool s)
 {
     actor   = a;
     path    = new List <TileBehavior>(p);
     success = s;
 }
コード例 #7
0
ファイル: Action.cs プロジェクト: FomTarro/CrimeTimeUNET
 public Movement(MapActor a, List<TileBehavior> p, bool s)
 {
     actor = a;
     path = new List<TileBehavior>(p);
     success = s;
 }
コード例 #8
0
ファイル: Action.cs プロジェクト: FomTarro/CrimeTimeUNET
 public Attack(MapActor a, MapActor t, bool s)
 {
     actor = a;
     target = t;
     success = s;
 }
コード例 #9
0
    public void CommitToAttack(MapActor target)
    {
        Attack attack = new Attack(unit, target, true);

        StartCoroutine(Execute(attack));
    }