Ejemplo n.º 1
0
    private void OnCollisionEnter(Collision col)
    {
        /////Son
        //collisionObstacle.set3DAttributes(FMODUnity.RuntimeUtils.To3DAttributes(transform.position));
        //collisionObstacle.start();
        /////Son

        if (!this.isLaunchPlayer)
        {
            if (col.transform.tag.Contains(this.groundTag))
            {
                this.rigid.isKinematic = true;
            }
        }
        else
        {
            if (col.transform.tag.Contains(this.groundTag) && !col.transform.tag.Contains("PMouvante"))
            {
                Vector3 normal = col.contacts[0].normal;

                Pillier p = BoltNetwork.Instantiate(BoltPrefabs.PillieCube, this.transform.position - new Vector3(0, 0.4f, 0), this.pillierRotate).GetComponent <Pillier>();
                //p.transform.SetParent(hit.transform);
                p.Init(state.MyOwner, state.MyColor, this.currentDir, col.contacts[0].point, normal);

                this.myGuardian.AddPillierToMyList(p);
                //BoltNetwork.Destroy(this.gameObject);
                DestroyOnPickUp();
            }
            else if (col.transform.tag.Contains("PMouvante"))
            {
                CheckGround();
            }
        }
    }
Ejemplo n.º 2
0
 public void RemovePillier(Pillier pToRemove)
 {
     if (this.myPillier.Contains(pToRemove))
     {
         this.myPillier.Remove(pToRemove);
     }
     //this.currentPillier = this.currentPillier > 0 ? this.currentPillier - 1 : 0;
 }
Ejemplo n.º 3
0
    public void AddPillierToMyList(Pillier pillierToAdd)
    {
        //if (this.CurrentPillier < this.maxPillier)
        //{
        this.myPillier.Add(pillierToAdd);

        if (this.myPillier.Count > this.maxPillier)
        {
            //Destroy(this.myPillier[0].gameObject);
            this.myPillier[0].ActiveDestroy();
            this.myPillier.RemoveAt(0);
        }
        //}
    }
Ejemplo n.º 4
0
    private void CheckGround()
    {
        RaycastHit hit;
        bool       raycast = Physics.Raycast(transform.position, Vector3.down, out hit, 0.5f, groundLayerMask);

        if (raycast)
        {
            Pillier p = BoltNetwork.Instantiate(BoltPrefabs.PillieCube, this.transform.position - new Vector3(0, 0.4f, 0), this.pillierRotate).GetComponent <Pillier>();
            //p.transform.SetParent(hit.transform);
            p.Init(state.MyOwner, state.MyColor, this.currentDir, hit.point, Vector3.zero);

            this.myGuardian.AddPillierToMyList(p);
            //BoltNetwork.Destroy(this.gameObject);
            DestroyOnPickUp();
        }
    }
Ejemplo n.º 5
0
    private Vector3 RespawnPoint()
    {
        int[] point        = new int[NetworkCallbacks.SpawnPointsTransforms.Length];
        int   currentPoint = 9999999;
        int   currentIndex = 0;

        for (int i = 0; i < point.Length; i++)
        {
            Collider[] col = Physics.OverlapSphere(NetworkCallbacks.SpawnPointsTransforms[i].transform.position, 8f);
            if (col.Length > 0)
            {
                for (int j = 0; j < col.Length; j++)
                {
                    Guardian g = col[j].GetComponent <Guardian>();
                    Pillier  p = col[j].GetComponent <Pillier>();
                    if (g != null)
                    {
                        point[i] += 2;
                    }
                    else if (p != null)
                    {
                        point[i] += 1;
                    }
                }
            }
            else
            {
                point[i] = 0;
            }
        }

        for (int i = 0; i < point.Length; i++)
        {
            if (point[i] <= currentPoint)
            {
                currentPoint = point[i];
                currentIndex = i;
            }
        }

        return(NetworkCallbacks.SpawnPointsTransforms[currentIndex].transform.position + Vector3.up * 2);
    }
Ejemplo n.º 6
0
    IEnumerator CheckObject()
    {
        while (!this.canLauchAxe)
        {
            yield return(new WaitForEndOfFrame());

            bool       check     = true;
            bool       objetFind = false;
            Collider[] col       = Physics.OverlapCapsule(this.pointOneAxeLaunch.position, this.pointTwoAxeLaunch.position, axeRadiusLaunchCheck, ~ignoreLayerMask);
            Vector3    dir       = myGuardian.transform.position - this.transform.position;
            if (col != null && check && !objetFind)
            {
                for (int i = 0; i < col.Length; i++)
                {
                    Guardian g = col[i].GetComponent <Guardian>();
                    Pillier  p = col[i].GetComponent <Pillier>();
                    if (g != null)
                    {
                        if (g != myGuardian && g != lastGuardian)//&& !g.IsStuned)
                        {
                            if (!g.IsStuned && !g.IsDie && !g.IsInvinsible)
                            {
                                lastGuardian = g;

                                if (!this.BackToBucheron)
                                {
                                    dir = -dir;
                                }

                                //dir.y = 0;
                                g.SetStun(dir.normalized, forcePush, this.myGuardian.GetComponent <BoltEntity>());
                                objetFind = true;
                                /////Son
                                collisionPlayer.set3DAttributes(FMODUnity.RuntimeUtils.To3DAttributes(transform.position));
                                collisionPlayer.start();
                                /////Son

                                GameObject go = Instantiate(contactParticulePrefab, this.transform.position,
                                                            Quaternion.LookRotation(-dir, Vector3.up));
                                Destroy(go, 1.8f);

                                check = false;
                            }
                        }
                    }
                    else if (p != null && this.canDestroyPillier)
                    {
                        p.DestroyPillier();
                        /////Son
                        collisionDecor.set3DAttributes(FMODUnity.RuntimeUtils.To3DAttributes(transform.position));
                        collisionDecor.start();
                        /////Son
                        objetFind = true;
                        check     = false;
                    }
                    else
                    {
                        /////Son
                        collisionDecor.set3DAttributes(FMODUnity.RuntimeUtils.To3DAttributes(transform.position));
                        collisionDecor.start();
                        /////Son
                        objetFind = true;
                        check     = false;
                    }
                }
            }

            if (objetFind)
            {
                //ActiveBackToBucheron();
                this.axeLaunchTimer = 1f;
            }
        }
        yield break;
    }