예제 #1
0
    float lastTimeOfGettingLightElement = 0;        //为了放止在光球被销毁之前发生二次拾取

    public void OnLighting(RaycastHit2D hit, Vector3 direction, RayLight light)
    {
        if (isPausing || GameGlobal.GameData.isPausing)
        {
            return;
        }
        //判断人物是否能随光线移动
        bool flag = false;

        if (PlayerParticleController.lightQuantity > 0)
        {
            RayLight.LightColor playerColor = RayLight.GetLight(PlayerParticleController.lightQuantity).lightColor;
            RayLight.LightColor lightColor  = light.lightColor;
            if (playerColor == RayLight.LightColor.white)
            {
                flag = true;
            }
            else
            {
                if (playerColor == lightColor)
                {
                    flag = true;
                }
            }
        }
        //移动人物
        if (flag)
        {
            transform.Translate(-direction * Time.deltaTime * velocityOnLighting);
            if (verticalVelocity < 0)
            {
                verticalVelocity = 0;
            }
        }
    }
    public override void Operate0(int lightQuantity)
    {
        base.Operate0(lightQuantity);
        RayLight light = RayLight.GetLight(lightQuantity);

        deltaLightQuantity = luncher.ChangeEmitStatus(light);
    }
예제 #3
0
    bool haveFence(RaycastHit2D[] hits)
    {
        if (hits == null)
        {
            return(false);
        }
        else
        {
            bool flag = false;
            foreach (RaycastHit2D hit in hits)
            {
                if (!hit.collider.isTrigger)
                {
                    if (hit.collider.tag != "ColorfulPlatform")
                    {
                        flag = true;
                    }
                    //若目标平台是有颜色需求的
                    else
                    {
                        //获取目标平台脚本控件
                        ColorfulPlatform platInstance = hit.collider.transform.parent.parent.GetComponent <ColorfulPlatform>();

                        RayLight            playerLight   = RayLight.GetLight(PlayerParticleController.lightQuantity);
                        RayLight.LightColor platformColor = hit.collider.transform.parent.parent.GetComponent <ColorfulPlatform>().platformColor;
                        //若颜色一样
                        if (playerLight.lightColor == platformColor)
                        {
                            flag = true;
                        }
                        //反之
                        else
                        {
                            if (playerLight.lightColor == RayLight.LightColor.white &&
                                playerLight.LightQuantity != 0)
                            {
                                flag = true;
                            }
                            else
                            {
                                flag = false;
                                platInstance.OnScene();
                            }
                        }
                    }
                }
            }
            return(flag);
        }
    }
예제 #4
0
    public override void OnLighting(RaycastHit2D hit, Vector3 direction, RayLight light)
    {
        base.OnLighting(hit, direction, light);
        if (this.light == null)
        {
            this.light = light;
        }
        else
        {
            this.light = RayLight.GetLight(light.LightQuantity + this.light.LightQuantity);
        }

        isEmitting = true;
    }
예제 #5
0
    public void ActivateEvent()
    {
        //如果前置条件不满足,则退出
        foreach (TriggerEvent eve in preEvents)
        {
            if (eve.isUsed == false)
            {
                return;
            }
        }
        //如果光的颜色需求不符,则退出
        if (isLightColorNeeded)
        {
            RayLight playerLight = RayLight.GetLight(PlayerParticleController.lightQuantity);
            bool     flag        = false;
            //若颜色一样
            if (playerLight.lightColor == lightColorNeeded)
            {
                flag = true;
            }
            //反之
            else
            {
                if (playerLight.lightColor == RayLight.LightColor.white &&
                    playerLight.LightQuantity != 0)
                {
                    flag = true;
                }
                else
                {
                    flag = false;
                }
            }
            if (flag == false)
            {
                return;
            }
        }
        //如果已经激活过,则退出
        if (isUsed)
        {
            return;
        }
        isUsed = true;

        //广播事件
        eventList();
    }
예제 #6
0
    void ResetHUD()
    {
        GameObject hud = GameObject.Find("UI/HUDCanvas");

        //检查场景是否搭载了HUD组件
        if (hud == null)
        {
            Debug.LogError("场景中缺少HUD组件");
            return;
        }

        //获取HUD组件
        Image lq_image   = hud.transform.Find("LightQuantity/Image").GetComponent <Image>();
        Text  lq_text    = hud.transform.Find("LightQuantity/Text").GetComponent <Text>();
        Text  pick_text  = hud.transform.Find("PickMode/Text").GetComponent <Text>();
        Text  pick_point = hud.transform.Find("PickMode/Point").GetComponent <Text>();

        //设置HUD光数
        Color currentColor = RayLight.GetLight(PlayerParticleController.lightQuantity).Color;

        lq_image.color = currentColor;
        lq_text.color  = currentColor;
        lq_text.text   = PlayerParticleController.lightQuantity.ToString();

        //设置拾取模式的显示
        if (isPickMode)
        {
            pick_point.color = Color.green;
            pick_text.text   = "  拾取模式";
        }
        else
        {
            pick_point.color = Color.red;
            pick_text.text   = "  锁定模式";
        }
    }
예제 #7
0
 protected override void GameBehavierInit()
 {
     base.GameBehavierInit();
     lightNeed = RayLight.GetLight(lightColorNeed, lightLevelNeed);
 }