Exemple #1
0
    void Start()
    {
        anim             = GetComponent <Animator>();
        myBody           = GetComponent <Rigidbody2D>();
        InteractionModel = GetComponent <CharacterInteractionModel>();
        HideWeapon();
        audio             = gameObject.AddComponent <AudioSource>();
        audio.playOnAwake = false;
        audio.volume      = 0.8f;
        attackSounds      = Resources.LoadAll("Sounds/AttacksBis");
        pointsSound       = Resources.LoadAll("Sounds/Coins");
        hurtSound         = Resources.Load("Sounds/Hurt");
        shootSounds       = Resources.LoadAll("Sounds/Shoot");
        heartSound        = Resources.Load("Sounds/heart");
        wrongSound        = Resources.Load("Sounds/wrong");
        setFrozen(false, true);

        GlobalBehavior global = GameObject.FindGameObjectWithTag("Global").GetComponent <GlobalBehavior> ();

        if (SceneManager.GetActiveScene().name == "Level1")
        {
            global.initValue();
        }

        maxHp     = global.maxHpPlayer;
        damage    = global.damagePlayer;
        moveSpeed = global.moveSpeedPlayer;
        InitPoint(global.scorePlayer);
        Debug.Log(maxHp);
        Debug.Log(damage);
        Debug.Log(moveSpeed);

        currentHp = maxHp;
        UpdateDisplayHearts();
    }
 //Init all systems by finding their gamecomponent
 private void Awake()
 {
     m_MovementModel    = GetComponent <CharacterMovementModel>();
     m_MovementView     = GetComponent <CharacterMovementView>();
     m_InteractionModel = GetComponent <CharacterInteractionModel>();
     m_BombModel        = GetComponent <CharacterBombModel>();
 }
Exemple #3
0
 void Awake()
 {
     m_MovementModel    = GetComponent <CharacterMovementModel>();
     m_MovementView     = GetComponent <CharacterMovementView>();
     m_InteractionModel = GetComponent <CharacterInteractionModel>();
     m_pocketModel      = GetComponent <CharacterPocketModel>();
 }
Exemple #4
0
    void UnregisterInteractable()
    {
        CharacterInteractionModel characterInteractionModel = GetCharacterInteractionModel();

        if (characterInteractionModel == null)
        {
            return;
        }
        characterInteractionModel.RemoveInteractable(this);
    }
    public Inventory m_Inventory; //this is for debugging purposes

    void Awake()
    {
        m_MovementModel    = GetComponent <CharacterMovementModel>();
        m_MovementView     = GetComponent <CharacterMovementView>();
        m_InteractionModel = GetComponent <CharacterInteractionModel>();
        if (gameObject.tag == "Player")
        {
            m_AttackManager = GetComponentInChildren <AttackManager>();
        }
    }
Exemple #6
0
    void Awake()
    {
        character = this;

        m_MovementModel       = MovementModel;
        m_InteractionModel    = InteractionModel;
        m_MovementView        = MovementView;
        m_InventoryModel      = InventoryModel;
        m_AttackableCharacter = AttackableCharacter;
        m_CharacterAudio      = AudioCharacter;
    }
    public override void OnInteract(Character character)
    {
        CharacterInteractionModel interactionModel = character.GetComponent <CharacterInteractionModel>();

        if (interactionModel == null)
        {
            return;
        }

        BroadcastMessage("OnPickUpObject", character, SendMessageOptions.DontRequireReceiver);
        interactionModel.PickUpObject(this);
    }
 void Awake()
 {
     character          = GetComponent <Character>();
     m_MovementModel    = GetComponent <CharacterMovementModel>();
     m_MovementView     = GetComponent <CharacterMovementView>();
     m_InteractionModel = GetComponent <CharacterInteractionModel>();
     m_EquipmentModel   = GetComponents <EquipmentBaseModel>();
     holdTimers         = new float[3];
     canUse             = new bool[3] {
         true, true, true
     };
 }
    public override void OnInteract(Character character)
    {
        CharacterInteractionModel interactionModel = character.GetComponent <CharacterInteractionModel>();

        if (interactionModel == null)
        {
            return;
        }

        rb.velocity = Vector3.zero;
        isBeingHeld = true;
        interactionModel.PickupObject(this);
        stopMoving = false;
    }
Exemple #10
0
    private CharacterInteractionModel GetCharacterInteractionModel()
    {
        GameObject playerObject = GameObject.FindWithTag("Player");

        if (playerObject == null)
        {
            Debug.LogWarning("Interactable: playerObject not found");
            return(null);
        }
        CharacterInteractionModel characterInteractionModel = playerObject.GetComponent <CharacterInteractionModel>();

        if (characterInteractionModel == null)
        {
            Debug.LogWarning("Interactable: characterInteractionModel not found");
            return(null);
        }
        return(characterInteractionModel);
    }
    CharacterInteractionModel FindCharacterInteractionModel()
    {
        GameObject playerObject = GameObject.FindGameObjectWithTag("Player");

        if (playerObject == null)
        {
            Debug.LogWarning("No player found");
            return(null);
        }

        CharacterInteractionModel interactionModel = playerObject.GetComponent <CharacterInteractionModel>(); //Here the scripts grabs the interactionmodel of the playable character

        if (interactionModel == null)
        {
            Debug.LogWarning("No interactionmodel found on player");
            return(null);
        }

        return(interactionModel);
    }
Exemple #12
0
    public override void OnInteract(Character character)
    {
        CharacterInteractionModel InteractionModel = character.GetComponent <CharacterInteractionModel>();

        if (InteractionModel == null)
        {
            Debug.LogWarning("No Advanced Movemodel found on Interact!");
            return;
        }

        BroadcastMessage("OnPickupObject", character, SendMessageOptions.DontRequireReceiver);
        character.InteractionModel.PickUpObject(this);
        Collider2D[] colliders = GetComponents <Collider2D>();
        foreach (Collider2D col in colliders)
        {
            if (col.isTrigger == false)
            {
                col.enabled = false;
            }
        }
    }
    public override void OnInteract(Character _character)
    {
        CharacterInteractionModel interactionModel = _character.GetComponent <CharacterInteractionModel>();

        character = _character;


        if (interactionModel == null)
        {
            return;
        }

        if (!isGrabbing)
        {
            interactionModel.GrabObject(this, character);
            isGrabbing = true;
            distance   = Vector3.Distance(character.transform.position, transform.position);
        }
        else
        {
            isGrabbing = false;
        }
    }
 void Awake() 
 {
     m_Model = GetComponent<CharacterInteractionModel>();
 }
Exemple #15
0
 void Awake()
 {
     characterMovementModel    = GetComponent <CharacterMovementModel>();
     characterInteractionModel = GetComponent <CharacterInteractionModel>();
     quantesVegadesEspai       = 0;
 }
Exemple #16
0
 //Init things
 private void Awake()
 {
     m_MovementModel    = GetComponent <CharacterMovementModel>();
     m_InteractionModel = GetComponent <CharacterInteractionModel>();
     m_Collider         = GetComponent <Collider2D>();
 }
Exemple #17
0
 private void Awake()
 {
     MovementModel    = GetComponent <CharacterMovementModel>();
     MovementView     = GetComponent <CharacterMovementView>();
     InteractionModel = GetComponent <CharacterInteractionModel>();
 }
 void Awake()
 {
     m_MovementModel = GetComponent<CharacterMovementModel>();
     m_MovementView = GetComponent<CharacterMovementView>();
     m_InteractionModel = GetComponent<CharacterInteractionModel>();
 }
 void Awake()
 {
     characterMovement  = GetComponent <CharacterMovementModel>();
     m_InteractionModel = GetComponent <CharacterInteractionModel>();
     col = GetComponent <Collider2D>();
 }
 void Awake()
 {
     m_MovementModel = GetComponent<CharacterMovementModel>();
     m_InteractionModel = GetComponent<CharacterInteractionModel>();
     m_Collider = GetComponent<Collider2D>();
 }
 private void Awake()
 {
     m_Model = GetComponent <CharacterInteractionModel>();
 }
Exemple #22
0
 void Awake()
 {
     m_Renderer    = GetComponentInChildren <SpriteRenderer>();
     m_Interaction = GetComponentInParent <CharacterInteractionModel>();
 }
 void Awake()
 {
     m_MovementModel    = GetComponent <CharacterMovementModel>();
     m_InteractionModel = GetComponent <CharacterInteractionModel>();
 }