public IArrayAbstraction <Variable, Expression> Assign(int dimension, TouchKind kind, Variable dest, Variable value)
        {
            if (this.content.ContainsKey(dimension))
            {
                Expression destExp, valueExp;
                switch (kind)
                {
                case TouchKind.Strong:
                    destExp  = this.encoder.VariableFor(dest);
                    valueExp = this.encoder.VariableFor(value);

                    this.content[dimension].Assign(destExp, valueExp);
                    break;

                case TouchKind.Weak:
                    var result = (IAbstractDomainForEnvironments <Variable, Expression>) this.content[dimension].Top.Clone();

                    destExp  = this.encoder.VariableFor(dest);
                    valueExp = this.encoder.VariableFor(value);

                    result.Assign(destExp, valueExp);

                    this.content[dimension] = (IAbstractDomainForEnvironments <Variable, Expression>) this.content[dimension].Join(result);
                    break;
                }
            }
            else
            {
                throw new AbstractInterpretationException();
            }

            return((IArrayAbstraction <Variable, Expression>) this);
        }
Exemple #2
0
        /// <summary>
        /// Simulate touching the character in TalkScene with mouse.
        /// </summary>
        /// <param name="talkScene">Talk scene</param>
        /// <param name="touchLocation">Where to touch</param>
        /// <param name="touchKind">How to touch</param>
        /// <param name="touchPosition">Optional position at which the touch happened (essentially mouse position)</param>
        public static void Touch(this TalkScene talkScene, TouchLocation touchLocation, TouchKind touchKind, Vector3 touchPosition = default)
        {
            var tv = Traverse.Create(talkScene);

            var tmf      = tv.Field <int>("m_touchMode");
            var prevKind = tmf.Value;

            tmf.Value = (int)touchKind;

            tv.Method("TouchFunc", new[] { typeof(string), typeof(Vector3) }).GetValue(touchLocation.ToString(), touchPosition);

            tmf.Value = prevKind;
        }
        /// <summary>
        /// Simulate touching the character in TalkScene with mouse.
        /// </summary>
        /// <param name="talkScene">Talk scene</param>
        /// <param name="touchLocation">Where to touch</param>
        /// <param name="touchKind">How to touch</param>
        /// <param name="touchPosition">Optional position at which the touch happened (essentially mouse position)</param>
        public static void Touch(this TalkScene talkScene, TouchLocation touchLocation, TouchKind touchKind, Vector3 touchPosition = default)
        {
            var prevKind = talkScene.m_touchMode;

            talkScene.m_touchMode = (int)touchKind;

            talkScene.TouchFunc(touchLocation.ToString(), touchPosition);

            talkScene.m_touchMode = prevKind;
        }