void Start() { _default_Position = transform.localPosition; _default_Rotation = transform.localEulerAngles; Ice.Is_Jump_Before = false; Ice.IsOnIce = false; WideWallColliderBefore = null; _nature = HumanManager.Nature; _human = _nature.Human_Script; ItemColliderManager skill_Manager = _human.transform.GetComponentInChildren <ItemColliderManager>(); StaticParameter.JudgeNull("_human", _human); StaticParameter.JudgeNull("skill_Manager", skill_Manager); _item_Collider = skill_Manager.gameObject; _item_Collider.SetActive(false); _effect = (GameObject)StaticParameter.LoadObject("GameEffect", "effect"); _protect_Broke_Mobel = (GameObject)StaticParameter.LoadObject("Other", "ProtectBroke"); }
public readonly float Right_Wide_Wall_Inside; //右侧宽墙内侧坐标 #endregion //构造,给属性赋值 public HumanNature(int mark) { _follow_Spring = new FollowSpring(false); //Debug.Log("属性初始化"); HumanEvolution hero = FindObjectOfType <HumanEvolution>(); //墙体属性 HumanManager.WallMark = WallMark.Left; //现在所处墙体的标记 HumanManager.JumpMark = JumpMark.Normal; //跳跃类型标记 var left_Wall = MyFind(MyTags.Left_Tag, MyTags.Wall_Layer); var right_Wall = MyFind(MyTags.Right_Tag, MyTags.Wall_Layer); var left_Wide_Wall = MyFind(MyTags.Left_Tag, MyTags.Wide_Wall_Layer); var right_Wide_Wall = MyFind(MyTags.Right_Tag, MyTags.Wide_Wall_Layer); Left_Wall_Inside = left_Wall.GetComponent <MeshRenderer>().bounds.max.x; Right_Wall_Inside = right_Wall.GetComponent <MeshRenderer>().bounds.min.x; Left_Wide_Wall_Inside = left_Wide_Wall.GetComponent <MeshRenderer>().bounds.max.x; Right_Wide_Wall_Inside = right_Wide_Wall.GetComponent <MeshRenderer>().bounds.min.x; //速度 //Slope = hero.Slope; //斜率 Jump_Speed = hero.Jump_Speed; //跳跃速度 Run_Speed = hero.Run_Speed; //人物奔跑速度 if (Jump_Speed == 0 || Run_Speed == 0) { Debug.Log("速度被赋值了0,自动赋值默认值"); Jump_Speed = 14.0f * Time.fixedDeltaTime; //跳跃速度 Run_Speed = 5.5f * Time.fixedDeltaTime; //人物奔跑速度 } Slow_Speed = Run_Speed * 0.5f; //减速后的速度 //道具时间 Dash_Time = hero.Dash_Time; //冲锋时间 Double_Time = hero.Double_Time; //双倍时间 Protect_Time = hero.Protect_Time; //护盾时间 Super_Man_Time = hero.SuperMan_Time; //无敌时间 Magnet_Time = hero.Magnet_Time; //磁铁时间 //人物相关属性 Off_Set = 0.1f; Skill_List = hero.InherentSkillList; //人物技能列表 Buy_Items_List = BuyTheItems.Buy_Items_List; //开局前购买的道具 HumanManager_Script = FindObjectOfType <HumanManager>(); Human_Script = hero; Human = hero.transform; Human_Ani = Human.transform.GetComponent <Animator>(); Main_Camera = GameObject.FindGameObjectWithTag("MainCamera").transform; Difference_Y = Main_Camera.position.y - Human.position.y; //人物和摄像机y轴上的初始位置差 Human_Mesh = GameObject.FindGameObjectWithTag("Player").GetComponent <SkinnedMeshRenderer>(); Human_Shader = Human_Mesh.material.shader; Human_Height = Human_Mesh.bounds.extents.y; Human_Helf_Height = Human.position.x - Human_Mesh.bounds.min.x; Vector3 temp = Camera.main.ScreenToWorldPoint(new Vector3(Camera.main.pixelWidth * 0.5f, Camera.main.pixelHeight * 0.25f, Human.transform.position.z - Camera.main.transform.position.z)); Human_Start_Position = new Vector3(Left_Wall_Inside + Human_Height * (0.5f - Off_Set), temp.y, left_Wall.transform.GetComponent <MeshRenderer>().bounds.center.z - 0.2f); End_Point = GameObject.Find("EndPoint").transform.GetComponent <Renderer>(); HumanCollider = Human.GetComponentInChildren <HumanColliderManager>(); Normal_Angle = HumanCollider.transform.localEulerAngles; if (Human_Ani == null) { Debug.Log("未找到动画组件"); } Human_Phantom = Human.GetComponent <Phantom>(); Human_Phantom.enabled = false; ColliderManager = GameObject.FindGameObjectWithTag("ColliderManager"); }