Exemplo n.º 1
0
    public void Init(UnitMeshConfig conf)
    {
        if (current != null)
        {
            //   List<GameObject> to_remove = new List<GameObject>();

            foreach (var rend in current)
            {
                Destroy(rend.gameObject);
            }
        }
        AnimationCallbackCaster caster = Target_Unit.GetComponent <AnimationCallbackCaster>();

        current = UnitFactory.SpawnSkinnedMeshToUnit(Target_Unit, MeshConfig.HeadConfig.GetHead().Mesh, MeshConfig.Suit);
        var wpn        = UnitFactory.SpawnWeaponMeshToUnit(Target_Unit, Weapon);
        var m_Animator = UnitFactory.MakeUnitAnimations(Target_Unit, wpn, wpn.WeaponIndex, caster, () => { return(false); });

        Target_Unit.GetComponent <Unit_EasterEgg>().Init(m_Animator);
    }
Exemplo n.º 2
0
    public void Init(WeaponMesh mesh)
    {
        if (current != null)
        {
            Destroy(current.AttachmentLeft);
            Destroy(current.AttachmentRight);
            Destroy(current.gameObject);
        }

        /*
         * if(m_Animator != null)
         * {
         *  caster.OnAbilityTrigger -= m_Animator.AbilityCallback;
         *  caster.OnWeaponHide -= m_Animator.WeaponHide;
         *  caster.OnWeaponShow -= m_Animator.WeaponShow;
         * }*/
        AnimationCallbackCaster caster = TargetUnit.GetComponent <AnimationCallbackCaster>();

        current = UnitFactory.SpawnWeaponMeshToUnit(TargetUnit, mesh);

        // UnitAnimation_IdleController idle = mesh.GetComponent<UnitAnimation_IdleController>();
        m_Animator = UnitFactory.MakeUnitAnimations(TargetUnit, current, current.WeaponIndex, caster, () => { return(IsRaged); });
    }
Exemplo n.º 3
0
    public static UnitAnimation MakeUnitAnimations(GameObject unit_mesh, WeaponMesh weapon, int index, AnimationCallbackCaster callbacks, GetBool b)
    {
        WeaponAnimator animator_right     = new WeaponAnimator(weapon.AttachmentRight, weapon.FX_Right, weapon.MuzzleRight);
        WeaponAnimator animator_left      = new WeaponAnimator(weapon.AttachmentLeft, weapon.FX_Left, weapon.MuzzleLeft);
        Animator       unit_animator      = unit_mesh.GetComponent <Animator>();
        UnitAnimation_IdleController idle = unit_mesh.GetComponent <UnitAnimation_IdleController>();

        return(new UnitAnimation().Init(unit_animator, animator_right, animator_left, index, callbacks, idle.GetId, b));
    }
Exemplo n.º 4
0
    public UnitAnimation Init(Animator unit, WeaponAnimator right, WeaponAnimator left, float index, AnimationCallbackCaster callback, GetInt get_id, GetBool rs)
    {
        GetIdle              = get_id;
        GetRage              = rs;
        WeaponAnimator_Left  = left;
        WeaponAnimator_Right = right;
        unit_animator        = unit;

        SetWeaponIndex(index);

        //No multicast so we dont need to remove listeners
        callback.OnAbilityTrigger = AbilityCallback;
        callback.OnWeaponHide     = WeaponHide;
        callback.OnWeaponShow     = WeaponShow;

        return(this);
    }