Exemplo n.º 1
0
 void OnTriggerExit(Collider other)
 {
     if (collisionItem != null && other.transform == collisionItem.transform)
     {
         collisionItem = null;
     }
 }
Exemplo n.º 2
0
    void OnTriggerEnter(Collider other)
    {
        ColorObjectBase colorObject = other.GetComponent<ColorObjectBase>();
        if (colorObject == null)
        {
            return;
        }

        if (colorObject.GetComponent<GraspItem>() != null)
        {
            collisionItem = colorObject.GetComponent<GraspItem>();

            // &の結果はブロックと消去グリッドの共通色
            // その色がブロックの色を全て含んでないならreturn
            if ((colorObject.objectColor.state & color.state) < colorObject.objectColor.state)
            {
                return;
            }

            burstParticle.transform.position = colorObject.transform.position;
            burstParticle.startColor = (Color)colorObject.objectColor;
            burstParticle.Play();
            colorObject.GetComponent<GraspItem>().Respawn();
        }
    }
Exemplo n.º 3
0
    void OnTriggerEnter(Collider other)
    {
        ColorObjectBase colorObject = other.GetComponent <ColorObjectBase>();

        if (colorObject == null)
        {
            return;
        }

        if (colorObject.GetComponent <GraspItem>() != null)
        {
            collisionItem = colorObject.GetComponent <GraspItem>();

            // &の結果はブロックと消去グリッドの共通色
            // その色がブロックの色を全て含んでないならreturn
            if ((colorObject.objectColor.state & color.state) < colorObject.objectColor.state)
            {
                return;
            }

            burstParticle.transform.position = colorObject.transform.position;
            burstParticle.startColor         = (Color)colorObject.objectColor;
            burstParticle.Play();
            colorObject.GetComponent <GraspItem>().Respawn();
        }
    }
Exemplo n.º 4
0
    void OnTriggerExit(Collider other)
    {
        if (isOver)
        {
            isNotOverChange = true;
        }

        if (other.tag != Tags.RideOn)
        {
            return;
        }

        GraspItem graspItem = other.transform.GetComponentInParent <GraspItem>();

        if (graspItem != null)
        {
            if (graspItem.isGrasp)
            {
                return;
            }
        }
        else if (other.GetComponentInParent <Player>() != null)
        {
            player.isRide = false;
        }
        else if (other.transform.parent == scaffoldingBody)
        {
            other.transform.parent = null;
        }
    }
Exemplo n.º 5
0
    void OnTriggerEnter(Collider other)
    {
        if (other.GetComponent <ColorBlock>() != null)
        {
            isOver = true;
            overCapacityTimeCount = 0.0f;
        }

        if (other.tag != Tags.RideOn)
        {
            return;
        }

        GraspItem graspItem = other.transform.GetComponentInParent <GraspItem>();

        if (graspItem != null)
        {
            if (!graspItem.isGrasp)
            {
                other.transform.parent.parent = scaffoldingBody;
            }
        }
        else if (other.GetComponentInParent <Player>() != null)
        {
            player.transform.parent = scaffoldingBody;
            player.rideScaffolds    = this;
            player.isRide           = true;
        }
        else
        {
            other.transform.parent.parent = scaffoldingBody;
        }
    }
Exemplo n.º 6
0
    void OnTriggerEnter(Collider other)
    {
        if (!isPossible)
        {
            return;
        }

        GraspItem grasp = other.GetComponentInParent <GraspItem>();

        if (grasp != null && grasp.isGrasp)
        {
            return;
        }

        if (other.tag == Tags.RideOn && !isWarp)
        {
            if (other.transform.parent.tag != Tags.Player)
            {
                Instantiate(warpEffectPrefab, other.transform.parent.position, Quaternion.identity);
                Instantiate(warpEffectPrefab, destinationObject.transform.position, Quaternion.identity);

                other.transform.parent.position = destinationObject.transform.position;
                other.transform.parent.rotation = destinationObject.transform.rotation;
                isWarp = true;

                if (destinationWarpZone != null)
                {
                    destinationObject.GetComponent <WarpZone>().isWarp = true;
                }
            }
            else
            {
                // プレイヤーが入ったとき。フェードアウトの演出が入る
                FadeManager.instance.Fade("", 0.5f,
                                          delegate()
                {
                    Instantiate(warpEffectPrefab, other.transform.parent.position, Quaternion.identity);
                    Instantiate(warpEffectPrefab, destinationObject.transform.position, Quaternion.identity);

                    player.StopLaser();
                    other.transform.parent.position = destinationObject.transform.position;
                    other.transform.parent.rotation = destinationObject.transform.rotation;
                    isWarp = true;
                    if (destinationWarpZone != null)
                    {
                        destinationObject.GetComponent <WarpZone>().isWarp = true;
                    }
                });
            }
        }
    }
Exemplo n.º 7
0
    /// <summary>
    /// 掴んでいるものを放す
    /// </summary>
    public void LetGo()
    {
        if (grabbedObject == null)
        {
            return;
        }

        grabbedObject.LetGo();
        if (player.rideScaffolds == null)
        {
            grabbedObject.InitParent();
        }
        else
        {
            grabbedObject.transform.parent = player.rideScaffolds.scaffoldingBody;
        }

        grabbedObject = null;
    }
Exemplo n.º 8
0
    protected override void Update()
    {
        base.Update();
        if (AdvancedWriteMessageSingleton.instance.isWrite)
        {
            return;
        }

        Collider[] colliders   = Physics.OverlapSphere(transform.position, radius);
        float      minDistance = Mathf.Infinity;

        Component[] iconOwnerCheckComponents = null;
        bool        isGrabbed = false;

        foreach (Collider hitCollider in colliders)
        {
            float       distance        = (hitCollider.transform.position - transform.position).sqrMagnitude;
            Component[] checkComponents = hitCollider.gameObject.GetComponents(typeof(ICheckEvent));
            if (distance < minDistance && checkComponents.Length != 0)
            {
                if (hitCollider.GetComponent <GraspItem>() != null && !hitCollider.GetComponent <GraspItem>().enabled)
                {
                    continue;
                }

                if (isGrabbed)
                {
                    if (hitCollider.GetComponent <GraspItem>() != null)
                    {
                        minDistance = distance;
                        iconOwnerCheckComponents = checkComponents;
                    }
                }
                else
                {
                    if (hitCollider.GetComponent <GraspItem>() != null)
                    {
                        isGrabbed = true;
                    }

                    minDistance = distance;
                    iconOwnerCheckComponents = checkComponents;
                }
            }
        }

        if (iconOwnerCheckComponents != null && iconOwnerCheckComponents.Length != 0)
        {
            if (grabbedObject == null)
            {
                foreach (ICheckEvent checkEvent in iconOwnerCheckComponents)
                {
                    checkEvent.ShowIcon();
                }

                if ((Input.GetKeyDown(KeyCode.E) || Input.GetMouseButtonDown(1)) && !player.isIrradiation)
                {
                    foreach (ICheckEvent component in iconOwnerCheckComponents)
                    {
                        component.Check();
                    }
                }
            }
            else
            {
                ExamineIconManager.HideIcon();
            }
        }
        else
        {
            ExamineIconManager.HideIcon();
        }

        if (hitList.Count != 0)
        {
            if (Input.GetMouseButtonDown(1) && !Input.GetMouseButton(0))
            {
                minDistance = Mathf.Infinity;
                GraspItem grabItem = null;
                foreach (GraspItem item in hitList)
                {
                    float distance = (item.transform.position - transform.position).magnitude;
                    if (minDistance > distance && !item.collider.isTrigger)
                    {
                        grabItem    = item.GetComponent <GraspItem>();
                        minDistance = distance;
                    }
                }

                if (grabItem != null)
                {
                    grabItem.Grab(transform.parent.gameObject);
                    grabbedObject = grabItem;
                    grabbedObject.transform.parent = transform.parent.parent;
                }
            }
        }

        if (grabbedObject != null)
        {
            bool isLetGo = false;             // 持ってるものを離す
            if ((transform.position - grabbedObject.transform.position).sqrMagnitude > grabbedLimitLeaving)
            {
                isLetGo = true;
            }
            else
            {
                grabbedObject.rigidbody.velocity = (transform.position - grabbedObject.transform.position) * grabbedMoveSpeed;
            }

            if (Input.GetMouseButtonUp(1))
            {
                isLetGo = true;
            }
            else if (grabbedObject.GetComponent <ColorObjectBase>() != null && grabbedObject.GetComponent <ColorObjectBase>().isDisappearance)
            {
                isLetGo = true;
            }

            if (isLetGo)
            {
                LetGo();
            }
        }
    }