internal void RegisterCamera(AmplifyMotionCamera camera) { Camera component = camera.GetComponent <Camera>(); if ((component.cullingMask & 1 << base.gameObject.layer) != 0 && !this.m_states.ContainsKey(component)) { MotionState value; switch (this.m_type) { case ObjectType.Solid: value = new SolidState(camera, this); break; case ObjectType.Skinned: value = new SkinnedState(camera, this); break; case ObjectType.Cloth: value = new ClothState(camera, this); break; default: throw new Exception("[AmplifyMotion] Invalid object type."); } camera.RegisterObject(this); this.m_states.Add(component, value); } }
internal void RegisterCamera(EasyflowCamera camera) { if (((camera.camera.cullingMask & (((int)1) << base.gameObject.layer)) != 0) && !this.m_states.ContainsKey(camera.camera)) { MotionState state = null; switch (this.m_type) { case EasyflowObjectType.Solid: state = new SolidState(camera, this); break; case EasyflowObjectType.Skinned: state = new SkinnedState(camera, this); break; case EasyflowObjectType.Cloth: state = new ClothState(camera, this); break; default: throw new Exception("[Easyflow] Invalid object type."); } camera.OnUpdateTransform += new EasyflowCamera.OnUpdateTransformDelegate(this.OnUpdateTransform); if (this.m_type == EasyflowObjectType.Cloth) { camera.OnCameraPostRender += new EasyflowCamera.OnCameraPostRenderDelegate(this.OnCameraPostRender); } this.m_states.Add(camera.camera, state); this.m_debugStates.Add(state); } }
public Cloth(string clothName, Sprite firstPic, ClothType thisType, string thisOwner, string atbs) { name = clothName; spritesInScenes[0] = firstPic; type = thisType; owner = thisOwner; state = ClothState.None; string[] splited = atbs.Split(' '); for (int i = 0; i < attributes.Length; i++) { attributes[i] = Int32.Parse(splited[i + 1]); } }
private bool IsTrue(ClothState threshold) { int counter = 0; foreach (var item in components) { if ((int)item.state >= (int)threshold) { counter++; } } ; return(counter == components.Length); }
public float GetInterval(ClothState state) { switch (state) { case ClothState.Wet: return(wet); case ClothState.MostlyWet: return(mostlyWet); case ClothState.MostlyDry: return(mostlyDry); case ClothState.Dry: return(dry); default: return(0); } }
private void Update() { if (!isDrying || state == ClothState.Dry) { return; } interval -= Time.deltaTime; if (interval <= 0) { switch (state) { case ClothState.Wet: state = ClothState.MostlyWet; break; case ClothState.MostlyWet: state = ClothState.MostlyDry; break; case ClothState.MostlyDry: state = ClothState.Dry; break; } SetInterval(state); } }
private void SetInterval(ClothState state) { interval = ClothStateInterval.Instance.GetInterval(state); }
private void Start() { defaultPos = transform.position; state = ClothState.Wet; SetInterval(state); }