Exemplo n.º 1
0
    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);
        }
    }
Exemplo n.º 2
0
    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);
        }
    }
Exemplo n.º 3
0
    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]);
        }
    }
Exemplo n.º 4
0
    private bool IsTrue(ClothState threshold)
    {
        int counter = 0;

        foreach (var item in components)
        {
            if ((int)item.state >= (int)threshold)
            {
                counter++;
            }
        }
        ;

        return(counter == components.Length);
    }
Exemplo n.º 5
0
    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);
        }
    }
Exemplo n.º 6
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);
        }
    }
Exemplo n.º 7
0
 private void SetInterval(ClothState state)
 {
     interval = ClothStateInterval.Instance.GetInterval(state);
 }
Exemplo n.º 8
0
 private void Start()
 {
     defaultPos = transform.position;
     state      = ClothState.Wet;
     SetInterval(state);
 }