void Start()
    {
        pathingGrid = GetComponent <PathingGrid>();
        pathManager = GetComponent <PathManager>();
        pathFinding = GetComponent <Pathfinding2>();

        InitialiseGrid();
    }
Exemple #2
0
    void Start()
    {
        pathfinding = GetComponent <Pathfinding2>();
        manager     = GetComponent <PathManager>();

        pathfinding.SetGrid(grid);
        pathfinding.SetPathManager(manager);
        grid.CreateGrid();
    }
Exemple #3
0
    void Start()
    {
        tileHolder  = new GameObject("Grid Tiles");
        pathingGrid = GetComponent <PathingGrid>();
        pathManager = GetComponent <PathManager>();
        pathFinding = GetComponent <Pathfinding2>();

        gridTiles = new List <Tile>();

        //GenerateGrid();
    }
Exemple #4
0
    public IEnumerator attack()
    {
        //temporalko
        if (this.GetComponent <StatsPlayer>().canWalk == 0)
        {
            this.GetComponent <Unit>().move(grid.NodeFromWorldPoint(playerattacked.transform.position).worldPosition, range);
            this.GetComponent <Unit>().RpcMoveClient(range, grid.NodeFromWorldPoint(playerattacked.transform.position).worldPosition, transform.position);
        }

        while (this.GetComponent <StatsPlayer>().skillActive == skillID)
        {
            if (!playerattacked.GetComponent <StatsPlayer>().death)
            {
                Node auxTarget = grid.NodeFromWorldPoint(playerattacked.transform.position);
                if (Pathfinding2.GetDistance2(grid.NodeFromWorldPoint(this.transform.position), auxTarget) > range &&
                    !this.GetComponent <NetworkPlayer>().walking &&
                    this.GetComponent <StatsPlayer>().canWalk == 0)
                {
                    if (auxTarget.walkable)
                    {
                        this.GetComponent <Unit>().move(auxTarget.worldPosition, range);
                        this.GetComponent <Unit>().RpcMoveClient(range, auxTarget.worldPosition, transform.position);
                    }
                }
                else if (Pathfinding2.GetDistance2(grid.NodeFromWorldPoint(this.transform.position), auxTarget) <= range && !this.GetComponent <NetworkPlayer>().walking)
                {
                    if (!Physics.Linecast(transform.position, playerattacked.transform.position, mask2))
                    {
                        animatorPlayer.Play("atkMode");
                        RpcAnimationatk(playerIdAtacked);

                        yield return(new WaitForSeconds(0.5f / this.GetComponent <StatsPlayer>().speedatk));

                        if (this.GetComponent <StatsPlayer>().skillActive == skillID)
                        {
                            playerattacked.GetComponent <StatsPlayer>().TakeDamage(damage, this.GetComponent <NetworkIdentity>().netId);
                        }
                        if (!autoAttack)
                        {
                            this.GetComponent <StatsPlayer>().skillActive = 0;
                        }
                    }
                }
            }
            else
            {
                this.GetComponent <StatsPlayer>().skillActive = 0;
            }
            yield return(null);
        }
    }
 public void snapSkill()
 {
     if (this.GetComponent <StatsPlayer>().skillActive == skillID &&
         GetComponent <StatsPlayer>().canskill == 0 &&
         GetComponent <StatsPlayer>().canWalk == 0 &&
         Pathfinding2.GetDistance2(
             GameObject.Find("A*").GetComponent <Grid>().NodeFromWorldPoint(this.transform.position),
             GameObject.Find("A*").GetComponent <Grid>().NodeFromWorldPoint(point)) <= range &&
         !GetComponent <NetworkPlayer>().walking)
     {
         PathRequestMaganer2.RequestPath(transform.position, point, snap);
         RpcMovesnap();
     }
 }
 public void CastSkill3()
 {
     if (this.GetComponent <StatsPlayer>().skillActive == skillID &&
         GetComponent <StatsPlayer>().canskill == 0 &&
         Pathfinding2.GetDistance2(
             GameObject.Find("A*").GetComponent <Grid>().NodeFromWorldPoint(this.transform.position),
             GameObject.Find("A*").GetComponent <Grid>().NodeFromWorldPoint(point)) <= range &&
         !GetComponent <NetworkPlayer>().walking &&
         cooldown_curring == 0 &&
         !GetComponent <StatsPlayer>().isCasting)
     {
         StartCoroutine(GetComponent <CastTimer>().castSkill(castTime, Skill3Attack, point));
     }
 }
Exemple #7
0
 public void CmdKarthus(Vector3 _point)
 {
     if (GetComponent <StatsPlayer>().canskill == 0 && cooldown_curring == 0)
     {
         point = _point;
         this.GetComponent <StatsPlayer>().skillActive = skillID;
         if (Pathfinding2.GetDistance2(
                 GameObject.Find("A*").GetComponent <Grid>().NodeFromWorldPoint(this.transform.position),
                 GameObject.Find("A*").GetComponent <Grid>().NodeFromWorldPoint(point)) > range)
         {
             this.GetComponent <Unit>().move2(point, range, CastSkill5);
             this.GetComponent <Unit>().RpcMoveClient(range, point, transform.position);
         }
         else
         {
             this.GetComponent <Unit>().move2(this.transform.position, range, CastSkill5);
             this.GetComponent <Unit>().RpcMoveClient(range, this.transform.position, transform.position);
         }
     }
 }
Exemple #8
0
 void Start()
 {
     instance    = this;
     pathfinding = GetComponent <Pathfinding2>();
 }
 void Awake()
 {
     instance    = this;
     pathfinding = GetComponent <Pathfinding2>();
 }