Ejemplo n.º 1
0
    public void Activate(GameObject owner, MoveEditor.ProjectileEventInfo projectileEventInfo, OnProjectileDeactivated callback)
    {
        _owner = owner.GetMonoILRComponent <DynamicMonoILRObject>();

        AttributeData attr = _owner.OnGetAttributeData("GetAnimator");

        if (_fxHelper != null)
        {
            //_fxHelper.Init(owner);
        }

        if (owner != null)
        {
            Activate(attr.Animator, projectileEventInfo, callback, false); //owner.ID == 1 );
        }
        else
        {
            EB.Debug.LogWarning("Failed to activate projectile!");
        }
    }
Ejemplo n.º 2
0
    /// <summary>
    /// 初始化ILR,可主动调用
    /// </summary>
    public void ILRObjInit()
    {
        if (_ilrObject == null && !string.IsNullOrEmpty(hotfixClassPath))
        {
#if ILRuntime
            _ilrObject = HotfixILRManager.GetInstance().appdomain.Instantiate <DynamicMonoILRObject>(hotfixClassPath);
#else
            var type = HotfixILRManager.GetInstance().assembly.GetType(hotfixClassPath);
            //UnityEngine.Debug.LogError("type :"+ type.Name);
            _ilrObject = System.Activator.CreateInstance(type) as DynamicMonoILRObject;
#endif

            _ilrObject.SetMono(this);

            if (_ilrObject != null)
            {
                _ilrObject.Awake();
            }
        }
    }
Ejemplo n.º 3
0
    // get perfect normalized offset
    private Vector3 CalculatePerfectNormalizedGroundPlaneOffset(CameraBase playerCamera)
    {
        float       yawOffset  = !IsGameCamera() ? _params.yawOffset : 0f;
        const float FullCircle = 360f;
        float       baseAngle  = GlobalCameraData.Instance.gameCameraAngleDegrees;

        if (_params != null && _params.useTargetLocalSpace && _targets != null && _targets.Count > 0)
        {
            Vector3 targetAngle = _targets[0].transform.eulerAngles;
            baseAngle = targetAngle.y;

            if (_params.yawFlipped)
            {
                //Combatant combatant_obj = _targets[0].GetComponent<Combatant>();
                //if (combatant_obj != null)
                //{

                //    if (combatant_obj.IsAttackingRightSide())
                //    {
                //        yawOffset = -yawOffset;
                //    }
                //}

                DynamicMonoILRObject ilObj = _targets[0].GetMonoILRComponent <DynamicMonoILRObject>(false);
                if (ilObj != null)
                {
                    AttributeData attr = ilObj.OnGetAttributeData("IsAttackingRightSide");
                    if (attr.IsAttackingRightSide)
                    {
                        yawOffset = -yawOffset;
                    }
                }
            }
        }

        float camAngleRad = Mathf.Deg2Rad * ((baseAngle + yawOffset) % FullCircle);

        return(new Vector3(Mathf.Sin(camAngleRad), 0f, Mathf.Cos(camAngleRad)));
    }