// add a new key
    public void addKey(int _frame, Vector3 _position, int _interp, int _easeType)
    {
        foreach (AMTranslationKey key in keys)
        {
            // if key exists on frame, update key
            if (key.frame == _frame)
            {
                key.position = _position;
                key.interp   = _interp;
                key.easeType = _easeType;
                // update cache
                updateCache();
                return;
            }
        }
        AMTranslationKey a = ScriptableObject.CreateInstance <AMTranslationKey>();

        a.frame    = _frame;
        a.position = _position;
        a.interp   = _interp;
        a.easeType = _easeType;
        // add a new key
        keys.Add(a);
        // update cache
        updateCache();
    }
Exemple #2
0
    // copy properties from key
    public override AMKey CreateClone()
    {
        AMTranslationKey a = ScriptableObject.CreateInstance <AMTranslationKey>();

        a.frame      = frame;
        a.position   = position;
        a.interp     = interp;
        a.easeType   = easeType;
        a.customEase = new List <float>(customEase);

        return(a);
    }
    // add a new key, default interpolation and easeType
    public void addKey(int _frame, Vector3 _position)
    {
        foreach (AMTranslationKey key in keys)
        {
            // if key exists on frame, update key
            if (key.frame == _frame)
            {
                AMUtil.recordObject(key, "update key");
                key.position = _position;
                // update cache
                updateCache();
                return;
            }
        }
        AMTranslationKey a = ScriptableObject.CreateInstance <AMTranslationKey>();

        a.frame    = _frame;
        a.position = _position;
        // add a new key
        AMUtil.recordObject(this, "add key");
        keys.Add(a);
        // update cache
        updateCache();
    }